OSDN Git Service

dict.c: use av_mallocz instead of av_realloc
authorPaweł Hajdan, Jr <phajdan@google.com>
Tue, 29 Jan 2013 11:41:10 +0000 (11:41 +0000)
committerMichael Niedermayer <michaelni@gmx.at>
Tue, 29 Jan 2013 19:23:02 +0000 (20:23 +0100)
commit1d81f7448c8aa7df4aaed612fcd032dbccbd1a96
tree33efc243879512b6bfa9a23b33ab7eb29ce687f1
parent0dfc01c2bbf4b71bb56201bc4a393321e15d1b31
dict.c: use av_mallocz instead of av_realloc

Memory passed to av_realloc must come from malloc,
calloc or realloc, and not e.g. memalign. realloc(3):

The realloc() function changes the size of the memory block pointed to
by ptr to size bytes. (...) Unless ptr is NULL, it must have been
returned by an earlier call to malloc(), calloc() or realloc().

The issue has been found by debugallocation, a part of google-perftools:
http://code.google.com/p/gperftools/ .

This makes fate pass when using LD_PRELOAD-ed debugallocation.

See also earlier discussion
http://ffmpeg.org/pipermail/ffmpeg-devel/2013-January/137234.html

Signed-off-by: Paweł Hajdan, Jr <phajdan@google.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavutil/dict.c