signalapp / libsignal-protocol-c

GNU General Public License v3.0
1.41k stars 295 forks source link

Unnecessary null checks before freeing #108

Open ariccio opened 6 years ago

ariccio commented 6 years ago

I have:


Bug description

I was just reading through the code as a matter of curiosity - I've always loved signal, and wanted to see the C implementation - and noticed that you're checking if a pointer is null many times before freeing them. This is perfectly valid, but absolutely not necessary, as free always checks for this on it's own. It thus leads to unnecessary code bloat. Nothing wrong with saving a few bytes!

Actual result: extra generated code, thus extra bloat.

Edit: see signal_protocol.c for examples.