summaryrefslogtreecommitdiff
path: root/tests/tga/bug00084.c
diff options
context:
space:
mode:
authorPierre Joye <pierre.php@gmail.com>2022-02-01 15:09:01 +0700
committerGitHub <noreply@github.com>2022-02-01 15:09:01 +0700
commit167ea1f4f0003f3e9f7ca1e586189e99cf33d47f (patch)
treea21a237b619b048e0c6d88388744cf9f029d47ae /tests/tga/bug00084.c
parent3d760c2c213f7a63dbe13792262406177cd9738a (diff)
downloadlibgd-167ea1f4f0003f3e9f7ca1e586189e99cf33d47f.tar.gz
Fix tests based on coverity reports (#819)
* Partial #818, unused arg * Partial #818, init var * partail #818, fix va_args usage * partail #818, handle f* calls and avoid possible call to malloc with negative values * partail #818, prevent double free * partail #818, resource leak if test fail * partail #818, null deref fix * partail #818, avoid double free on fp failure * Partial #818, fix error msg * Partial #818, leak on error * Partial #818, null deref * Partial #818, avoid possible negative index on failure * partial #818, does not free if we return if requested new size overflow * partial #818, avoid double free, free where the alloc happened
Diffstat (limited to 'tests/tga/bug00084.c')
-rw-r--r--tests/tga/bug00084.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/tests/tga/bug00084.c b/tests/tga/bug00084.c
index 7d4ca92..3cf0710 100644
--- a/tests/tga/bug00084.c
+++ b/tests/tga/bug00084.c
@@ -7,7 +7,13 @@ int main()
{
gdImagePtr im;
FILE *fp = gdTestFileOpen("tga/bug00084.tga");
+ if (gdTestAssert(fp == NULL)) {
+ return 1;
+ }
im = gdImageCreateFromTga(fp);
- gdImageDestroy(im);
+ fclose(fp);
+ if (gdTestAssert(im != NULL)) {
+ gdImageDestroy(im);
+ }
return 0;
}