diff options
author | Rostislav Pehlivanov <atomnuker@gmail.com> | 2017-07-26 23:54:14 +0100 |
---|---|---|
committer | Rostislav Pehlivanov <atomnuker@gmail.com> | 2017-07-26 23:54:14 +0100 |
commit | 133dafe24fc7167b049bb14fb5ec2d199d8cddcc (patch) | |
tree | 4ed089abd4a72250e57e75be13872d6ce18241f4 | |
parent | 5d0b69f3b7e5b28804c84e50c593606b597f5956 (diff) | |
download | ffmpeg-133dafe24fc7167b049bb14fb5ec2d199d8cddcc.tar.gz |
pngdec: fix potential memory leak
Fixes CID1412026.
Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
-rw-r--r-- | libavcodec/pngdec.c | 5 |
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); |