tests: fix leaks in test code

Ensure all images etc. are freed so that we can enable leak checking
across the tests and not get any false positives.
master
David Drysdale 2015-12-04 15:38:23 +00:00 committed by Mike Frysinger
parent 4e61c9b021
commit 05d70f6a07
6 changed files with 10 additions and 0 deletions

View File

@ -45,6 +45,7 @@ int main()
/* Destroy it */
gdImageDestroy(im);
gdImageDestroy(tile);
return error;
}

View File

@ -51,6 +51,7 @@ int main()
/* Destroy it */
gdImageDestroy(im);
gdImageDestroy(tile);
return error;
}

View File

@ -110,6 +110,9 @@ void do_test()
blurblank(im, 4, 0.0);
blurblank(im, 8, 0.0);
blurblank(im, 16, 0.0);
gdImageDestroy(im);
gdImageDestroy(imref);
}/* do_test*/
/* Ensure that RGB values are equal, then return r (which is therefore
@ -185,6 +188,7 @@ void do_crosstest()
gdTestAssert(getwhite(blurred, 1, LY + 1) < getwhite(blurred, 1, LY + 3));
gdTestAssert(getwhite(blurred, 1, LY + 3) < getwhite(blurred, 1, HEIGHT-1));
gdImageDestroy(blurred);
gdImageDestroy(im);
}/* do_crosstest*/

View File

@ -15,5 +15,6 @@ int main()
gdImageLine(im, 1,1, 50, 50, gdAntiAliased);
/* Test for segfaults, if we reach this point, the test worked */
gdImageDestroy(im);
return 0;
}

View File

@ -51,6 +51,7 @@ void scaletest(int x, int y, int nx, int ny)
gdTestAssert(gdMaxPixelDiff(imref, same) < CLOSE_ENOUGH);
gdImageDestroy(im);
gdImageDestroy(imref);
gdImageDestroy(tmp);
gdImageDestroy(same);
}/* scaletest*/
@ -77,6 +78,7 @@ void do_test(int x, int y, int nx, int ny)
gdImageDestroy(same);
gdImageDestroy(im);
gdImageDestroy(imref);
/* Scale horizontally, vertically and both. */
scaletest(x, y, nx, y);

View File

@ -40,6 +40,7 @@ int main()
return 1;
}
gdImageDestroy(im);
return 0;
#endif
}