mirror of
https://github.com/webmproject/libwebp.git
synced 2024-12-26 05:38:22 +01:00
check VP8LBitWriterInit return
Change-Id: I460906281598f5792bd75a25b14b449c8daaff8c
This commit is contained in:
parent
cbfa9eecf4
commit
183cba83a7
@ -84,8 +84,8 @@ static int EncodeLossless(const uint8_t* const data, int width, int height,
|
||||
config.quality = 10.f + 15.f * effort_level;
|
||||
if (config.quality > 100.f) config.quality = 100.f;
|
||||
|
||||
VP8LBitWriterInit(&tmp_bw, (width * height) >> 3);
|
||||
ok = (VP8LEncodeStream(&config, &picture, &tmp_bw) == VP8_ENC_OK);
|
||||
ok = VP8LBitWriterInit(&tmp_bw, (width * height) >> 3);
|
||||
ok = ok && (VP8LEncodeStream(&config, &picture, &tmp_bw) == VP8_ENC_OK);
|
||||
WebPPictureFree(&picture);
|
||||
if (ok) {
|
||||
const uint8_t* const data = VP8LBitWriterFinish(&tmp_bw);
|
||||
|
@ -1057,7 +1057,10 @@ int VP8LEncodeImage(const WebPConfig* const config,
|
||||
|
||||
width = picture->width;
|
||||
height = picture->height;
|
||||
VP8LBitWriterInit(&bw, (width * height) >> 1);
|
||||
if (!VP8LBitWriterInit(&bw, (width * height) >> 1)) {
|
||||
err = VP8_ENC_ERROR_OUT_OF_MEMORY;
|
||||
goto Error;
|
||||
}
|
||||
|
||||
if (!WebPReportProgress(picture, 1, &percent)) {
|
||||
UserAbort:
|
||||
|
Loading…
Reference in New Issue
Block a user