Skip to content

Commit

Permalink
FFmpegImage: Check some more allocations
Browse files Browse the repository at this point in the history
  • Loading branch information
fritsch committed Dec 22, 2015
1 parent 1e24a10 commit 407f1c5
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions xbmc/guilib/FFmpegImage.cpp
Expand Up @@ -131,6 +131,11 @@ bool CFFmpegImage::LoadImageFromMemory(unsigned char* buffer, unsigned int bufSi
{

uint8_t* fbuffer = (uint8_t*)av_malloc(FFMPEG_FILE_BUFFER_SIZE);
if (!fbuffer)
{
CLog::LogFunction(LOGERROR, __FUNCTION__, "Could not allocate FFMPEG_FILE_BUFFER_SIZE");
return false;
}
MemBuffer buf;
buf.data = buffer;
buf.size = bufSize;
Expand Down Expand Up @@ -282,6 +287,11 @@ bool CFFmpegImage::Decode(unsigned char * const pixels, unsigned int width, unsi
}

AVPicture* pictureRGB = static_cast<AVPicture*>(av_mallocz(sizeof(AVPicture)));
if (!pictureRGB)
{
CLog::LogFunction(LOGERROR, __FUNCTION__, "AVPicture could not be allocated");
return false;
}

int size = avpicture_fill(pictureRGB, NULL, AV_PIX_FMT_RGB32, width, height);
if (size < 0)
Expand Down

0 comments on commit 407f1c5

Please sign in to comment.