diff mbox series

[FFmpeg-devel,04/11] avformat/fitsdec: Fix potential leak of string in AVBPrint

Message ID 20200107135549.22581-4-andreas.rheinhardt@gmail.com
State Accepted
Headers show
Series [FFmpeg-devel,01/11] avformat/avformat: Update AVInputFormat.read_packet documentation | expand

Checks

Context Check Description
andriy/ffmpeg-patchwork success Make fate finished

Commit Message

Andreas Rheinhardt Jan. 7, 2020, 1:55 p.m. UTC
by freeing it a bit earlier.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
---
 libavformat/fitsdec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Michael Niedermayer Jan. 8, 2020, 12:40 a.m. UTC | #1
On Tue, Jan 07, 2020 at 02:55:42PM +0100, Andreas Rheinhardt wrote:
> by freeing it a bit earlier.
> 
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
> ---
>  libavformat/fitsdec.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

will apply

thx

[...]
diff mbox series

Patch

diff --git a/libavformat/fitsdec.c b/libavformat/fitsdec.c
index e917fc2375..e52ddc7e79 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);
     }