aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/utils.c
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2012-09-21 09:07:02 +0200
committerAnton Khirnov <anton@khirnov.net>2012-09-24 12:31:24 +0200
commita42aadabc64f50124eece6e37e63eafa46e1a6ce (patch)
tree7648076429da19b5786b59821ddbd9fb30f504cc /libavcodec/utils.c
parentb437cec143924eb2a7bbcbb7a7ec320d75d2edac (diff)
downloadffmpeg-a42aadabc64f50124eece6e37e63eafa46e1a6ce.tar.gz
lavc: add avcodec_free_frame().
Since an AVFrame now has malloced members (extended_data), it must have a destructor.
Diffstat (limited to 'libavcodec/utils.c')
-rw-r--r--libavcodec/utils.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index c2e16c4ada..0e4048ec6e 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -659,6 +659,21 @@ AVFrame *avcodec_alloc_frame(void)
return frame;
}
+void avcodec_free_frame(AVFrame **frame)
+{
+ AVFrame *f;
+
+ if (!frame || !*frame)
+ return;
+
+ f = *frame;
+
+ if (f->extended_data != f->data)
+ av_freep(&f->extended_data);
+
+ av_freep(frame);
+}
+
int attribute_align_arg avcodec_open2(AVCodecContext *avctx, const AVCodec *codec, AVDictionary **options)
{
int ret = 0;