mirror of
https://github.com/morgan9e/FreeRDP
synced 2026-04-14 00:14:11 +09:00
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:
@@ -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);
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user