diff options
author | Martin Storsjö <martin@martin.st> | 2012-04-08 17:38:45 +0300 |
---|---|---|
committer | Martin Storsjö <martin@martin.st> | 2012-04-10 11:56:42 +0300 |
commit | 14f063d294a18a31928d2167a66b1087910e14c8 (patch) | |
tree | 5682c191f420cefb276728be328e2f1a28cb60f9 /libavutil/tree.h | |
parent | e36b25d1df2ab30540c2d8939c5f2b0d6c059317 (diff) | |
download | ffmpeg-14f063d294a18a31928d2167a66b1087910e14c8.tar.gz |
mem: Consistently return NULL for av_malloc(0)
Plain POSIX malloc(0) is allowed to return either NULL or a
non-NULL pointer. The calling code should be ready to handle
a NULL return as a correct return (instead of a failure) if the size
to allocate was 0 - this makes sure the condition is handled
in a consistent way across platforms.
This also avoids calling posix_memalign(&ptr, 32, 0) on OS X,
which returns an invalid pointer (a non-NULL pointer that causes
crashes when passed to av_free).
Abort in debug mode, to help track down issues related to
incorrect handling of this case.
Signed-off-by: Martin Storsjö <martin@martin.st>
Diffstat (limited to 'libavutil/tree.h')
0 files changed, 0 insertions, 0 deletions