[FFmpeg-cvslog] pngdec: fix potential memory leak

Rostislav Pehlivanov git at videolan.org
Thu Jul 27 01:56:09 EEST 2017


ffmpeg | branch: master | Rostislav Pehlivanov <atomnuker at gmail.com> | Wed Jul 26 23:54:14 2017 +0100| [133dafe24fc7167b049bb14fb5ec2d199d8cddcc] | committer: Rostislav Pehlivanov

pngdec: fix potential memory leak

Fixes CID1412026.

Signed-off-by: Rostislav Pehlivanov <atomnuker at gmail.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=133dafe24fc7167b049bb14fb5ec2d199d8cddcc
---

 libavcodec/pngdec.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

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);



More information about the ffmpeg-cvslog mailing list