aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRostislav Pehlivanov <atomnuker@gmail.com>2017-07-26 23:54:14 +0100
committerRostislav Pehlivanov <atomnuker@gmail.com>2017-07-26 23:54:14 +0100
commit133dafe24fc7167b049bb14fb5ec2d199d8cddcc (patch)
tree4ed089abd4a72250e57e75be13872d6ce18241f4
parent5d0b69f3b7e5b28804c84e50c593606b597f5956 (diff)
downloadffmpeg-133dafe24fc7167b049bb14fb5ec2d199d8cddcc.tar.gz
pngdec: fix potential memory leak
Fixes CID1412026. Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
-rw-r--r--libavcodec/pngdec.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/libavcodec/pngdec.c b/libavcodec/pngdec.c
index f83884dfc2..4fc1c5a062 100644
--- a/libavcodec/pngdec.c
+++ b/libavcodec/pngdec.c
@@ -863,8 +863,11 @@ static int decode_iccp_chunk(PNGDecContext *s, int length, AVFrame *f)
av_bprint_finalize(&bp, (char **)&data);
- if (!(sd = av_frame_new_side_data(f, AV_FRAME_DATA_ICC_PROFILE, bp.len)))
+ sd = av_frame_new_side_data(f, AV_FRAME_DATA_ICC_PROFILE, bp.len);
+ if (!sd) {
+ av_free(data);
return AVERROR(ENOMEM);
+ }
av_dict_set(&sd->metadata, "name", profile_name, 0);
memcpy(sd->data, data, bp.len);