- #18, Removed invalid gdFree call when overflow2 fails
- #17, Free im->pixels as well on errormaster
parent
0a331ae455
commit
cfee163a5e
|
@ -39,3 +39,4 @@ GDBUGS NEWS
|
|||
(John Ellson/Graphviz)
|
||||
#17, Added "static" to entities_s struct declaration to avoid obscure
|
||||
compiler problem on Suns (John Ellson/Graphviz)
|
||||
#18, Removed invalid gdFree call when overflow2 fails
|
||||
|
|
7
src/gd.c
7
src/gd.c
|
@ -74,8 +74,10 @@ BGD_DECLARE(gdImagePtr) gdImageCreate (int sx, int sy)
|
|||
gdImagePtr im;
|
||||
|
||||
if (overflow2(sizeof (unsigned char *), sy)) {
|
||||
gdFree(im);
|
||||
return NULL;
|
||||
return NULL;
|
||||
}
|
||||
if (overflow2(sizeof (unsigned char *), sx)) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
im = (gdImage *) gdMalloc (sizeof (gdImage));
|
||||
|
@ -106,6 +108,7 @@ BGD_DECLARE(gdImagePtr) gdImageCreate (int sx, int sy)
|
|||
{
|
||||
gdFree(im->pixels[i]);
|
||||
}
|
||||
gdFree(im->pixels);
|
||||
gdFree(im);
|
||||
return NULL;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue