diff options
author | Pierre Joye <pierre.php@gmail.com> | 2022-02-01 12:32:51 +0700 |
---|---|---|
committer | Pierre Joye <pierre.php@gmail.com> | 2022-02-01 12:32:51 +0700 |
commit | 4050c66fa60c0270d7666a73c2c9009a95baec84 (patch) | |
tree | f881854b15b13129babf4848f2c2e8bc52eb09f4 | |
parent | 74c80434d675e61a8ea7878271e45467f558de6d (diff) | |
download | libgd-4050c66fa60c0270d7666a73c2c9009a95baec84.tar.gz |
partail #818, avoid double free on fp failure
-rw-r--r-- | tests/gdimagefill/bug00002_1.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/tests/gdimagefill/bug00002_1.c b/tests/gdimagefill/bug00002_1.c index 3a66d7b..d348f0b 100644 --- a/tests/gdimagefill/bug00002_1.c +++ b/tests/gdimagefill/bug00002_1.c @@ -21,13 +21,14 @@ int main() file = gdTestTempFile("bug00002_1.png"); fp = fopen(file, "wb"); - free(file); + if (fp == NULL) { gdTestErrorMsg("Cannot create image from <%s>\n", file); + free(file); gdImageDestroy(im); return 1; } - + free(file); gdImagePng(im,fp); fclose(fp); |