rdtk: Fix leak found by covscan

leaked_storage: Variable "fontBaseFile" going out of scope leaks the storage it points to.
leaked_storage: Variable "image" going out of scope leaks the storage it points to.
This commit is contained in:
Ondrej Holy
2018-08-20 09:10:49 +02:00
parent 0b7d0c2002
commit 3a5fdd0a39
2 changed files with 6 additions and 1 deletions

View File

@@ -612,7 +612,6 @@ rdtkFont* rdtk_font_new(rdtkEngine* engine, const char* path, const char* file)
strcpy(fontDescriptorFile, fontBaseFile);
strcpy(&fontDescriptorFile[length], ".xml");
free(fontBaseFile);
if (!PathFileExistsA(fontImageFile))
goto cleanup;
@@ -641,10 +640,12 @@ rdtkFont* rdtk_font_new(rdtkEngine* engine, const char* path, const char* file)
if (status < 0)
goto cleanup;
free(fontBaseFile);
free(fontImageFile);
free(fontDescriptorFile);
return font;
cleanup:
free(fontBaseFile);
free(fontImageFile);
free(fontDescriptorFile);

View File

@@ -390,6 +390,8 @@ int rdtk_nine_patch_engine_init(rdtkEngine* engine)
if (ninePatch)
rdtk_nine_patch_set_image(ninePatch, image);
else
winpr_image_free(image, TRUE);
}
}
@@ -414,6 +416,8 @@ int rdtk_nine_patch_engine_init(rdtkEngine* engine)
if (ninePatch)
rdtk_nine_patch_set_image(ninePatch, image);
else
winpr_image_free(image, TRUE);
}
}