aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2016-05-28 03:12:04 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2016-05-28 03:13:14 +0200
commit86d703fd5584ea90530b23982faff17c8488a704 (patch)
tree21b148fb4e8497760f2371150c7bd964f00f6f20 /libavformat
parent5db111757c89459fd515a7be23694e12d367138e (diff)
downloadffmpeg-86d703fd5584ea90530b23982faff17c8488a704.tar.gz
avformat/movenc: Fix memleak of reshuffled packet
Fixes CID1361952 Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavformat')
-rw-r--r--libavformat/movenc.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index 9db6852a18..51c3d2bd6d 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -4812,7 +4812,7 @@ static int mov_write_packet(AVFormatContext *s, AVPacket *pkt)
if (trk->par->format == AV_PIX_FMT_PAL8 && !trk->pal_done) {
ret = ff_get_packet_palette(s, opkt, reshuffle_ret, trk->palette);
if (ret < 0)
- return ret;
+ goto fail;
if (ret)
trk->pal_done++;
} else if (trk->par->codec_id == AV_CODEC_ID_RAWVIDEO &&
@@ -4823,7 +4823,9 @@ static int mov_write_packet(AVFormatContext *s, AVPacket *pkt)
}
if (reshuffle_ret) {
ret = mov_write_single_packet(s, pkt);
- av_packet_free(&pkt);
+fail:
+ if (reshuffle_ret)
+ av_packet_free(&pkt);
return ret;
}
}