Fixed memory leak.
This commit is contained in:
parent
b920f9a081
commit
9753b63dda
@ -675,18 +675,29 @@ rdtkFont* rdtk_embedded_font_new(rdtkEngine* engine, BYTE* imageData, int imageS
|
|||||||
font->image = winpr_image_new();
|
font->image = winpr_image_new();
|
||||||
|
|
||||||
if (!font->image)
|
if (!font->image)
|
||||||
|
{
|
||||||
|
free(font);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
status = winpr_image_read_buffer(font->image, imageData, imageSize);
|
status = winpr_image_read_buffer(font->image, imageData, imageSize);
|
||||||
|
|
||||||
if (status < 0)
|
if (status < 0)
|
||||||
|
{
|
||||||
|
winpr_image_free(font->image, TRUE);
|
||||||
|
free(font);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
size = descriptorSize;
|
size = descriptorSize;
|
||||||
buffer = (BYTE*) malloc(size);
|
buffer = (BYTE*) malloc(size);
|
||||||
|
|
||||||
if (!buffer)
|
if (!buffer)
|
||||||
|
{
|
||||||
|
winpr_image_free(font->image, TRUE);
|
||||||
|
free(font);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
CopyMemory(buffer, descriptorData, size);
|
CopyMemory(buffer, descriptorData, size);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user