Browse Source

pngdec: fix potential memory leak

Fixes CID1412026.

Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
tags/n3.4
Rostislav Pehlivanov 8 years ago
parent
commit
133dafe24f
1 changed files with 4 additions and 1 deletions
  1. +4
    -1
      libavcodec/pngdec.c

+ 4
- 1
libavcodec/pngdec.c View File

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


Loading…
Cancel
Save