This looks like it would be quite reasonable to always do this right after
I alloc something. I actually found a memory leak in my JSON2 code when
testing on pike 7.7 because string_to_utf8 potentially throws now (I think
that was not there in pike 7.6). I have the feeling that there are more
leaks of this types out there, especially because throwing behaviour
may/did change.
When having a quick look I found that in Math.transforms in rIFFT() there
are several Pike_error() calls after malloc. I guess that that part of
Math is not really used much, especially because librfftw does not
seem to be compatible anymore (may be wrong here).
I can write a patch later... there are also some typos I found some time
ago when reading the docs.
arne
On Sat, 23 Aug 2008, Marcus Comstedt (ACROSS) (Hail Ilpalazzo!) @ Pike (-)
developers forum wrote:
ONERROR handle;
SET_ONERROR (handle, my_free_function, my_mem);
/* do stuff which may throw */
UNSET_ONERROR (handle);
If you want my_free_function to be called even if nothing was thrown,
use CALL_AND_UNSET_ONERROR instead.