mirror of
https://github.com/webmproject/libwebp.git
synced 2024-12-26 05:38:22 +01:00
EncodeImageInternal: fix uninitialized free
on allocation error refs.refs would be uninitialized and free'd, causing a crash Change-Id: Idb7daec7aec3e5d769d8103595c28a9d0d0b86f4
This commit is contained in:
parent
3de58d7730
commit
b30add2017
@ -529,7 +529,12 @@ static int EncodeImageInternal(VP8LBitWriter* const bw,
|
|||||||
sizeof(*histogram_symbols));
|
sizeof(*histogram_symbols));
|
||||||
assert(histogram_bits >= MIN_HUFFMAN_BITS);
|
assert(histogram_bits >= MIN_HUFFMAN_BITS);
|
||||||
assert(histogram_bits <= MAX_HUFFMAN_BITS);
|
assert(histogram_bits <= MAX_HUFFMAN_BITS);
|
||||||
if (histogram_image == NULL || histogram_symbols == NULL) goto Error;
|
|
||||||
|
if (histogram_image == NULL || histogram_symbols == NULL) {
|
||||||
|
free(histogram_image);
|
||||||
|
free(histogram_symbols);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
// Calculate backward references from ARGB image.
|
// Calculate backward references from ARGB image.
|
||||||
if (!VP8LGetBackwardReferences(width, height, argb, quality, cache_bits,
|
if (!VP8LGetBackwardReferences(width, height, argb, quality, cache_bits,
|
||||||
|
Loading…
Reference in New Issue
Block a user