From e7d4a2a721ae863488f6a3814f9dcdbc6e8f5166 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Storsj=C3=B6?= Date: Wed, 8 Feb 2012 15:01:13 +0200 Subject: [PATCH] libavcodec: Don't do av_free(av_malloc(0)) for bitstream filters MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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ö --- libavcodec/bitstream_filter.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/bitstream_filter.c b/libavcodec/bitstream_filter.c index b803ca4ef9..ee56174b2c 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;