codec/progressive: Fix a memory leak

When checking whether tiles and updatedTileIndices are both non-NULL,
one of them might be NULL, while the other struct member might not
be NULL and progressive_surface_context_new() leaks then the non-NULL
struct member.

Fix this by freeing both struct members, when aborting in
progressive_surface_context_new().
free() will take no action on pointers that are NULL, so no additional
check is needed.
This commit is contained in:
Pascal Nowack 2021-05-24 16:49:57 +02:00 committed by akallabeth
parent 9914dbc770
commit 11248b18c1

View File

@ -454,6 +454,8 @@ static PROGRESSIVE_SURFACE_CONTEXT* progressive_surface_context_new(UINT16 surfa
if (!surface->tiles || !surface->updatedTileIndices)
{
free(surface->updatedTileIndices);
free(surface->tiles);
free(surface);
return NULL;
}