1984not-GmbH / molch

An implementation of the axolotl ratchet based on libsodium.
Other
23 stars 3 forks source link

Use macro to write NULL to every freed pointer #77

Closed FSMaxB closed 8 years ago

FSMaxB commented 8 years ago

When doing a free, the pointer should be overwritten with NULL so that it is impossible to use a freed pointer.

This looks like this:

#define free_and_null(pointer) free(pointer); pointer = NULL;
#define sodium_free_and_null(pointer) sodium_free(pointer); pointer = NULL;