]> git.codecow.com Git - Monocypher.git/commit
Don't free() NULL pointers
authorLoup Vaillant <loup@loup-vaillant.fr>
Sun, 24 Jun 2018 13:58:55 +0000 (15:58 +0200)
committerLoup Vaillant <loup@loup-vaillant.fr>
Sun, 24 Jun 2018 13:58:55 +0000 (15:58 +0200)
commit79f8285ea6cae0db2e906bf3eb65c8fcadabdaf8
treed4af2e73110b02f188fd396acb9bf1bd4fd292cc
parentaa38f41f6276b4c3cac43563055e6dde2e67b109
Don't free() NULL pointers

The alloc() function in the test suite unconditionally succeeds when
trying to allocate zero bytes.  It does so by returning NULL right away,
without exiting the program.  This was for portability for platforms
that refuse to allocate zero bytes.

Unfortunately, this meant that the test suite later called free() on
those NULL pointers, which is undefined.  Wrapping free() in a dealloc()
function avoids this error.
tests/test.c