mirror of
https://github.com/webmproject/libwebp.git
synced 2024-12-26 05:38:22 +01:00
WebPMuxCreate: fix unchecked malloc
Change-Id: Ic824cdfbede4abe8e5106904dd17d564bb1b32d4
This commit is contained in:
parent
eb425586e1
commit
7e4371c5b3
@ -174,7 +174,8 @@ uint8_t* ChunkListEmit(const WebPChunk* chunk_list, uint8_t* dst);
|
||||
// Initialize.
|
||||
void MuxImageInit(WebPMuxImage* const wpi);
|
||||
|
||||
// Delete image 'wpi'.
|
||||
// Delete image 'wpi' and return the next image in the list or NULL.
|
||||
// 'wpi' can be NULL.
|
||||
WebPMuxImage* MuxImageDelete(WebPMuxImage* const wpi);
|
||||
|
||||
// Delete all images in 'wpi_list'.
|
||||
|
@ -345,6 +345,7 @@ WebPMuxError MuxImageSetNth(const WebPMuxImage* wpi, WebPMuxImage** wpi_list,
|
||||
// MuxImage deletion methods.
|
||||
|
||||
WebPMuxImage* MuxImageDelete(WebPMuxImage* const wpi) {
|
||||
// Delete the components of wpi. If wpi is NULL this is a noop.
|
||||
WebPMuxImage* const next = MuxImageRelease(wpi);
|
||||
free(wpi);
|
||||
return next;
|
||||
|
@ -125,6 +125,7 @@ WebPMux* WebPMuxCreate(const uint8_t* data, uint32_t size, int copy_data,
|
||||
size -= RIFF_HEADER_SIZE;
|
||||
|
||||
wpi = (WebPMuxImage*)malloc(sizeof(*wpi));
|
||||
if (wpi == NULL) goto Err;
|
||||
MuxImageInit(wpi);
|
||||
|
||||
// Loop over chunks.
|
||||
|
Loading…
Reference in New Issue
Block a user