[x265] [PATCH] encoder: do not use std::list
Jan Ekstrom
jeebjp at gmail.com
Wed Sep 18 14:10:42 CEST 2013
On Wed, Sep 18, 2013 at 2:47 PM, Gopu Govindaswamy
<gopu at multicorewareinc.com> wrote:
>> Why don't you check your malloc return???
> X265_MALLOC Will take care of this
Huh? A malloc that does checks by itself? This got me interested.
Let's follow the trail!
X265_MALLOC is defined in Lib/TLibCommon/CommonDef.h as follows:
...
// for use in HM, replaces old xMalloc/xFree macros
#define X265_MALLOC(type, count) x265_malloc(sizeof(type) * (count))
...
x265_malloc() can on the other hand be found in common/common.cpp as follows:
...
void *x265_malloc(size_t size)
{
return _aligned_malloc(size, ALIGNBYTES);
}
...
(this is the shorter Win32 version, but the POSIX version is very
similar, it either returns the value given by posix_memalign() or
NULL)
So... uh... Yes, you need to check for the return value of
X265_MALLOC, the malloc can fail just fine without you noticing. Or
you just misunderstood the question asked :) .
Jan Ekström
More information about the x265-devel
mailing list