mirror of
https://github.com/webmproject/libwebp.git
synced 2025-04-08 09:56:49 +02:00
Fix next is invalid pointer when WebPSafeMalloc fails
When WebPSafeMalloc fails on VP8LHuffmanTablesAllocate, next is not initialized to NULL. VP8LHuffmanTablesDeallocate uses next to know the following nodes. A patch fixes this issue. Change-Id: I144ae84cd97e5bca227018ef1afa95361267902c
This commit is contained in:
parent
c1ffd9ac75
commit
dce8397fec
@ -267,11 +267,11 @@ int VP8LHuffmanTablesAllocate(int size, HuffmanTables* huffman_tables) {
|
|||||||
// Have 'segment' point to the first segment for now, 'root'.
|
// Have 'segment' point to the first segment for now, 'root'.
|
||||||
HuffmanTablesSegment* const root = &huffman_tables->root;
|
HuffmanTablesSegment* const root = &huffman_tables->root;
|
||||||
huffman_tables->curr_segment = root;
|
huffman_tables->curr_segment = root;
|
||||||
|
root->next = NULL;
|
||||||
// Allocate root.
|
// Allocate root.
|
||||||
root->start = (HuffmanCode*)WebPSafeMalloc(size, sizeof(*root->start));
|
root->start = (HuffmanCode*)WebPSafeMalloc(size, sizeof(*root->start));
|
||||||
if (root->start == NULL) return 0;
|
if (root->start == NULL) return 0;
|
||||||
root->curr_table = root->start;
|
root->curr_table = root->start;
|
||||||
root->next = NULL;
|
|
||||||
root->size = size;
|
root->size = size;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user