]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/options.c
ffmpeg_opt: fix attachment streams
[ffmpeg] / libavcodec / options.c
index b31483baa3aefcc343de0199cf0940f607d63b05..0026f88b89ecd657bf79f7733e4e146c4e05edbd 100644 (file)
@@ -154,6 +154,21 @@ AVCodecContext *avcodec_alloc_context3(const AVCodec *codec)
     return avctx;
 }
 
+void avcodec_free_context(AVCodecContext **pavctx)
+{
+    AVCodecContext *avctx = *pavctx;
+
+    if (!avctx)
+        return;
+
+    avcodec_close(avctx);
+
+    av_freep(&avctx->extradata);
+    av_freep(&avctx->subtitle_header);
+
+    av_freep(pavctx);
+}
+
 int avcodec_copy_context(AVCodecContext *dest, const AVCodecContext *src)
 {
     const AVCodec *orig_codec = dest->codec;
@@ -167,7 +182,6 @@ int avcodec_copy_context(AVCodecContext *dest, const AVCodecContext *src)
     }
 
     av_opt_free(dest);
-    av_free(dest->priv_data);
 
     memcpy(dest, src, sizeof(*dest));