Fix some memory leakage in test cases

Fix the memory leakage in following test cases: tests/bug_overflow_lagre_new_size.c, tests/gdimagecrop/bug00486.c, tests/bmp/bug00450.c
master
wilson chen 2020-03-19 23:22:14 +08:00 committed by willson-chen
parent a48dbca620
commit 08238a0ac2
3 changed files with 9 additions and 1 deletions

View File

@ -4,7 +4,8 @@
#include "gdtest.h"
int main(void) {
gdImagePtr im = gdImageCreateFromFile(gdTestFilePath("bmp/bug00450.bmp"));
char *path = gdTestFilePath("bmp/bug00450.bmp");
gdImagePtr im = gdImageCreateFromFile(path);
gdTestAssert(im != NULL);
if (im) {
@ -33,5 +34,7 @@ int main(void) {
gdImageDestroy(im);
}
free(path);
return gdNumFailures();
}

View File

@ -40,5 +40,9 @@ int main()
gdAssertImageEquals(croppedRight, croppedLeft);
gdImageDestroy(orig);
gdImageDestroy(croppedLeft);
gdImageDestroy(croppedRight);
return gdNumFailures();
}

View File

@ -22,6 +22,7 @@ int main()
im2 = gdImageScale(im,0x15555556, 1);
if (im2 == NULL) {
printf("gdImageScale failed, expected (out of memory or overflow validation\n");
gdImageDestroy(im);
return 0;
}
gdImageDestroy(im);