1984not-GmbH / molch

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

Check for NULL before freeing in free_and_null macros #84

Closed FSMaxB closed 7 years ago

FSMaxB commented 8 years ago

The various free_and_null macros should check if the pointer is NULL before attempting to free it. But then it should be renamed to free_and_null_if_valid or something.

This would convert code like this:

if (pointer != NULL) {
    free_and_null(pointer);
}

Into this:

free_and_null_if_valid(pointer);
FSMaxB commented 7 years ago

Done in #86