[FFmpeg-cvslog] avformat/fitsdec: Fix potential leak of string in AVBPrint

Andreas Rheinhardt git at videolan.org
Wed May 20 08:38:05 EEST 2020


ffmpeg | branch: release/4.2 | Andreas Rheinhardt <andreas.rheinhardt at gmail.com> | Tue Jan  7 14:55:42 2020 +0100| [9dad33fcaede598cc61860bb82699d73f0d2960b] | committer: Andreas Rheinhardt

avformat/fitsdec: Fix potential leak of string in AVBPrint

by freeing it a bit earlier.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
(cherry picked from commit bb20f3dd730689c3a99f7820cff8b74b06992fff)

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

 libavformat/fitsdec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/fitsdec.c b/libavformat/fitsdec.c
index c7d1edec60..30e34fc4d5 100644
--- a/libavformat/fitsdec.c
+++ b/libavformat/fitsdec.c
@@ -157,11 +157,11 @@ static int fits_read_packet(AVFormatContext *s, AVPacket *pkt)
 
     av_bprint_init(&avbuf, FITS_BLOCK_SIZE, AV_BPRINT_SIZE_UNLIMITED);
     while ((ret = is_image(s, fits, &header, &avbuf, &size)) == 0) {
+        av_bprint_finalize(&avbuf, NULL);
         pos = avio_skip(s->pb, size);
         if (pos < 0)
             return pos;
 
-        av_bprint_finalize(&avbuf, NULL);
         av_bprint_init(&avbuf, FITS_BLOCK_SIZE, AV_BPRINT_SIZE_UNLIMITED);
         avpriv_fits_header_init(&header, STATE_XTENSION);
     }



More information about the ffmpeg-cvslog mailing list