[FFmpeg-cvslog] libavcodec: Don't do av_free(av_malloc(0)) for bitstream filters

Martin Storsjö git at videolan.org
Sat Feb 11 01:35:33 CET 2012


ffmpeg | branch: master | Martin Storsjö <martin at martin.st> | Wed Feb  8 15:01:13 2012 +0200| [e7d4a2a721ae863488f6a3814f9dcdbc6e8f5166] | committer: Martin Storsjö

libavcodec: Don't do av_free(av_malloc(0)) for bitstream filters

This fixes crashes on exit when closing a bitstream filter that
hasn't allocated any private data, on OS X.

Signed-off-by: Martin Storsjö <martin at martin.st>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e7d4a2a721ae863488f6a3814f9dcdbc6e8f5166
---

 libavcodec/bitstream_filter.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/libavcodec/bitstream_filter.c b/libavcodec/bitstream_filter.c
index b803ca4..ee56174 100644
--- a/libavcodec/bitstream_filter.c
+++ b/libavcodec/bitstream_filter.c
@@ -39,7 +39,7 @@ AVBitStreamFilterContext *av_bitstream_filter_init(const char *name){
         if(!strcmp(name, bsf->name)){
             AVBitStreamFilterContext *bsfc= av_mallocz(sizeof(AVBitStreamFilterContext));
             bsfc->filter= bsf;
-            bsfc->priv_data= av_mallocz(bsf->priv_data_size);
+            bsfc->priv_data = bsf->priv_data_size ? av_mallocz(bsf->priv_data_size) : NULL;
             return bsfc;
         }
         bsf= bsf->next;



More information about the ffmpeg-cvslog mailing list