mirror of
https://github.com/webmproject/libwebp.git
synced 2025-07-19 15:29:48 +02:00
make error-code reporting consistent upon malloc failure
Sometimes, the error-code was not set correctly. We now return OUT_OF_MEMORY everytimes it's appropriate (tested using MALLOC_FAIL_AT mechanism) Took the opportunity to clean-up the code and dust the error code returned (some were erroneously set to INVALID_CONFIGURATION) Change-Id: I56f7331e2447557b3dd038e245daace4fc82214c
This commit is contained in:
@ -225,7 +225,7 @@ int VP8EmitTokens(VP8TBuffer* const b, VP8BitWriter* const bw,
|
||||
const uint8_t* const probas, int final_pass) {
|
||||
const VP8Tokens* p = b->pages_;
|
||||
(void)final_pass;
|
||||
if (b->error_) return 0;
|
||||
assert(!b->error_);
|
||||
while (p != NULL) {
|
||||
const VP8Tokens* const next = p->next_;
|
||||
const int N = (next == NULL) ? b->left_ : 0;
|
||||
@ -251,7 +251,7 @@ int VP8EmitTokens(VP8TBuffer* const b, VP8BitWriter* const bw,
|
||||
size_t VP8EstimateTokenSize(VP8TBuffer* const b, const uint8_t* const probas) {
|
||||
size_t size = 0;
|
||||
const VP8Tokens* p = b->pages_;
|
||||
if (b->error_) return 0;
|
||||
assert(!b->error_);
|
||||
while (p != NULL) {
|
||||
const VP8Tokens* const next = p->next_;
|
||||
const int N = (next == NULL) ? b->left_ : 0;
|
||||
|
Reference in New Issue
Block a user