Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update test calloc to handle NULL return and avoid invalid memory access and skip two tests while on macOS arm64 #147

Closed
wants to merge 1 commit into from

Commits on Feb 20, 2023

  1. fix(src/test_functions.c): update test calloc to handle NULL return a…

    …nd avoid invalid memory access
    
    The change updates the test code for the calloc function to handle the case where calloc returns
    NULL, which can happen if the nmemb or size parameter is 0 or if the function is unable to allocate
    memory. The updated test case explicitly checks for a NULL pointer before attempting to free it,
    which avoids the potential for undefined behavior caused by attempting to free a deallocated
    pointer. The change ensures that the test code follows the behavior described in the man page for
    calloc and should be portable across different systems and versions of the C standard library.
    MalwarePup committed Feb 20, 2023
    Configuration menu
    Copy the full SHA
    e5b3cef View commit details
    Browse the repository at this point in the history