[FFmpeg-cvslog] apetag: do not leak memory if avio_read() fails
Paul B Mahol
git at videolan.org
Sat Feb 25 04:28:16 CET 2012
ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Fri Feb 24 00:15:36 2012 +0000| [14c98973f5822f5ada53c4cc40c0bcf71744d812] | committer: Ronald S. Bultje
apetag: do not leak memory if avio_read() fails
Signed-off-by: Paul B Mahol <onemda at gmail.com>
Signed-off-by: Ronald S. Bultje <rsbultje at gmail.com>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=14c98973f5822f5ada53c4cc40c0bcf71744d812
---
libavformat/apetag.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/libavformat/apetag.c b/libavformat/apetag.c
index 378ae10..68c987e 100644
--- a/libavformat/apetag.c
+++ b/libavformat/apetag.c
@@ -75,8 +75,10 @@ static int ape_tag_read_field(AVFormatContext *s)
if (!value)
return AVERROR(ENOMEM);
c = avio_read(pb, value, size);
- if (c < 0)
+ if (c < 0) {
+ av_free(value);
return c;
+ }
value[c] = 0;
av_dict_set(&s->metadata, key, value, AV_DICT_DONT_STRDUP_VAL);
}
More information about the ffmpeg-cvslog
mailing list