summaryrefslogtreecommitdiff
path: root/libavformat/apetag.c
diff options
context:
space:
mode:
authorPaul B Mahol <onemda@gmail.com>2012-02-24 00:15:36 +0000
committerRonald S. Bultje <rsbultje@gmail.com>2012-02-23 16:16:37 -0800
commit14c98973f5822f5ada53c4cc40c0bcf71744d812 (patch)
treeb6b3540c1887505f2ee449e2a1961ef7535f0f79 /libavformat/apetag.c
parent6d11057006b30ee6737a77f712cdd6a8f7e6c3df (diff)
apetag: do not leak memory if avio_read() fails
Signed-off-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
Diffstat (limited to 'libavformat/apetag.c')
-rw-r--r--libavformat/apetag.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/libavformat/apetag.c b/libavformat/apetag.c
index 378ae10ad4..68c987e7e6 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);
}