libavcodec: Don't do av_free(av_malloc(0)) for bitstream filters
authorMartin Storsjö <martin@martin.st>
Wed, 8 Feb 2012 13:01:13 +0000 (15:01 +0200)
committerMartin Storsjö <martin@martin.st>
Thu, 9 Feb 2012 21:13:50 +0000 (23:13 +0200)
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@martin.st>
libavcodec/bitstream_filter.c

index b803ca4..ee56174 100644 (file)
@@ -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;