avframe: call release_buffer only if it is set
authorJanne Grunau <janne-libav@jannau.net>
Mon, 11 Mar 2013 15:24:36 +0000 (16:24 +0100)
committerJanne Grunau <janne-libav@jannau.net>
Mon, 11 Mar 2013 17:58:47 +0000 (18:58 +0100)
AVCodecContext release_buffer() shall be NULL for audio codecs using
get_buffer. The backward compatibility code hence have to check before
calling it.

libavcodec/utils.c

index 0106b91..b4c294e 100644 (file)
@@ -535,7 +535,8 @@ typedef struct CompatReleaseBufPriv {
 static void compat_free_buffer(void *opaque, uint8_t *data)
 {
     CompatReleaseBufPriv *priv = opaque;
-    priv->avctx.release_buffer(&priv->avctx, &priv->frame);
+    if (priv->avctx.release_buffer)
+        priv->avctx.release_buffer(&priv->avctx, &priv->frame);
     av_freep(&priv);
 }