diff options
author | Anton Khirnov <anton@khirnov.net> | 2012-09-21 09:07:02 +0200 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2012-09-24 12:31:24 +0200 |
commit | a42aadabc64f50124eece6e37e63eafa46e1a6ce (patch) | |
tree | 7648076429da19b5786b59821ddbd9fb30f504cc /libavcodec/utils.c | |
parent | b437cec143924eb2a7bbcbb7a7ec320d75d2edac (diff) | |
download | ffmpeg-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.c | 15 |
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; |