summaryrefslogtreecommitdiff
path: root/libavformat/idroqdec.c
diff options
context:
space:
mode:
authorAndreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>2016-11-29 00:43:27 +0100
committerAndreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>2016-11-30 00:22:45 +0100
commitc0175fa92b7edd45a06e4ab16c8e83da0c94a9f6 (patch)
treea274632551f7176d607a4f1c6b63751d44f1d14b /libavformat/idroqdec.c
parent94d3d98246fc10c2b9dec5d30ff647fa450ff835 (diff)
idroqdec: fix leaking pkt on failure
The code calls av_new_packet a few lines above and the allocated memory has to be freed in case of an error. Reviewed-by: Michael Niedermayer <michael@niedermayer.cc> Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
Diffstat (limited to 'libavformat/idroqdec.c')
-rw-r--r--libavformat/idroqdec.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/libavformat/idroqdec.c b/libavformat/idroqdec.c
index 83701b59c5..8fd67a6818 100644
--- a/libavformat/idroqdec.c
+++ b/libavformat/idroqdec.c
@@ -222,8 +222,10 @@ static int roq_read_packet(AVFormatContext *s,
pkt->pos= avio_tell(pb);
ret = avio_read(pb, pkt->data + RoQ_CHUNK_PREAMBLE_SIZE,
chunk_size);
- if (ret != chunk_size)
+ if (ret != chunk_size) {
+ av_packet_unref(pkt);
ret = AVERROR(EIO);
+ }
packet_read = 1;
break;