[FFmpeg-cvslog] idroqdec: fix leaking pkt on failure
Andreas Cadhalpun
git at videolan.org
Wed Nov 30 01:23:58 EET 2016
ffmpeg | branch: master | Andreas Cadhalpun <Andreas.Cadhalpun at googlemail.com> | Tue Nov 29 00:43:27 2016 +0100| [c0175fa92b7edd45a06e4ab16c8e83da0c94a9f6] | committer: Andreas Cadhalpun
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 at niedermayer.cc>
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun at googlemail.com>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=c0175fa92b7edd45a06e4ab16c8e83da0c94a9f6
---
libavformat/idroqdec.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/libavformat/idroqdec.c b/libavformat/idroqdec.c
index 83701b5..8fd67a6 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;
More information about the ffmpeg-cvslog
mailing list