mirror of
https://github.com/webmproject/libwebp.git
synced 2024-12-27 06:08:21 +01:00
pngdec: Avoid a double-free.
Earlier, at line#275, if ok == 0, it would have triggered a double free
of 'rgb'.
Change-Id: Iaee1f35824a66f6e4b488e523416f73b87c5ec30
(cherry picked from commit b68912af2c
)
This commit is contained in:
parent
dcbb1ca54a
commit
1fb04bec99
@ -207,7 +207,6 @@ int ReadPNG(FILE* in_file, WebPPicture* const pic, int keep_alpha,
|
|||||||
Error:
|
Error:
|
||||||
MetadataFree(metadata);
|
MetadataFree(metadata);
|
||||||
png_destroy_read_struct(&png, &info, &end_info);
|
png_destroy_read_struct(&png, &info, &end_info);
|
||||||
free(rgb);
|
|
||||||
goto End;
|
goto End;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -270,13 +269,13 @@ int ReadPNG(FILE* in_file, WebPPicture* const pic, int keep_alpha,
|
|||||||
pic->use_argb = 1;
|
pic->use_argb = 1;
|
||||||
ok = has_alpha ? WebPPictureImportRGBA(pic, rgb, stride)
|
ok = has_alpha ? WebPPictureImportRGBA(pic, rgb, stride)
|
||||||
: WebPPictureImportRGB(pic, rgb, stride);
|
: WebPPictureImportRGB(pic, rgb, stride);
|
||||||
free(rgb);
|
|
||||||
|
|
||||||
if (!ok) {
|
if (!ok) {
|
||||||
goto Error;
|
goto Error;
|
||||||
}
|
}
|
||||||
|
|
||||||
End:
|
End:
|
||||||
|
free(rgb);
|
||||||
return ok;
|
return ok;
|
||||||
}
|
}
|
||||||
#else // !WEBP_HAVE_PNG
|
#else // !WEBP_HAVE_PNG
|
||||||
|
Loading…
Reference in New Issue
Block a user