...in case the allocation fails. The old res pointer will leak then, I think the right way would be to never realloc() to the same pointer variable in one line and in case of failure, make sure the old one is free()'d if it's no longer used (as is the case here). My bad if I'm mistaken, I didn't actually confirm a memory leak via valgrind or something.
These look like potential memory leaks to me:
https://github.com/schellingb/TinySoundFont/blob/d21fe7b22c8c906e749e4be4bb389efc2e761964/tsf.h#L908
https://github.com/schellingb/TinySoundFont/blob/d21fe7b22c8c906e749e4be4bb389efc2e761964/tsf.h#L918
...in case the allocation fails. The old
res
pointer will leak then, I think the right way would be to neverrealloc()
to the same pointer variable in one line and in case of failure, make sure the old one isfree()
'd if it's no longer used (as is the case here). My bad if I'm mistaken, I didn't actually confirm a memory leak via valgrind or something.