Realloc memory leak
When running cppcheck on the Octave sources, we found the memory leak patched by the following suggestion:
--- a/gl2ps.c Sun Jan 16 08:58:46 2011 -0600 +++ b/gl2ps.c Sun Jan 16 11:13:59 2011 -0600 @@ -306,9 +306,11 @@ static void *gl2psRealloc(void *ptr, size_t size) { if(!size) return NULL;
- ptr = realloc(ptr, size);
- void *orig = ptr;
- ptr = realloc(orig, size); if(!ptr){ gl2psMsg(GL2PS_ERROR, "Couldn't reallocate requested memory");
- free(orig); return NULL; } return ptr;
Thanks, Jordi G. H. jordigh@gmail.com