ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinha...@outlook.com> | Wed Mar 17 16:49:44 2021 +0100| [72cfc80d7b500a7f66b1bb7373f67f549c1774c6] | committer: Andreas Rheinhardt
avcodec/pngdec: Improve decoding text chunks By checking immediately whether the first allocation was successfull one can simplify the cleanup code in case of errors. Signed-off-by: Andreas Rheinhardt <andreas.rheinha...@outlook.com> > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=72cfc80d7b500a7f66b1bb7373f67f549c1774c6 --- libavcodec/pngdec.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/libavcodec/pngdec.c b/libavcodec/pngdec.c index 132ad40dc9..1d6ca7f4c3 100644 --- a/libavcodec/pngdec.c +++ b/libavcodec/pngdec.c @@ -551,12 +551,13 @@ static int decode_text_chunk(PNGDecContext *s, GetByteContext *gb, int compresse text_len = data_end - data; } - kw_utf8 = iso88591_to_utf8(keyword, keyword_end - keyword); txt_utf8 = iso88591_to_utf8(text, text_len); if (compressed) av_bprint_finalize(&bp, NULL); - if (!(kw_utf8 && txt_utf8)) { - av_free(kw_utf8); + if (!txt_utf8) + return AVERROR(ENOMEM); + kw_utf8 = iso88591_to_utf8(keyword, keyword_end - keyword); + if (!kw_utf8) { av_free(txt_utf8); return AVERROR(ENOMEM); } _______________________________________________ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog To unsubscribe, visit link above, or email ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".