]> git.sesse.net Git - ffmpeg/commitdiff
aviobuf: check context before using it
authorVittorio Giovara <vittorio.giovara@gmail.com>
Sat, 18 Oct 2014 00:12:13 +0000 (01:12 +0100)
committerVittorio Giovara <vittorio.giovara@gmail.com>
Mon, 20 Oct 2014 09:38:38 +0000 (10:38 +0100)
Avoid a possible null pointer dereference.

CC: libav-stable@libav.org
Bug-Id: CID 1135769

libavformat/aviobuf.c

index cc791462254ba00fae118292d465ad741c39f4b9..6923b78ea10888e65c5313f213430a0be967a0f1 100644 (file)
@@ -965,7 +965,7 @@ int ffio_open_dyn_packet_buf(AVIOContext **s, int max_packet_size)
 
 int avio_close_dyn_buf(AVIOContext *s, uint8_t **pbuffer)
 {
-    DynBuffer *d = s->opaque;
+    DynBuffer *d;
     int size;
     static const char padbuf[FF_INPUT_BUFFER_PADDING_SIZE] = {0};
     int padding = 0;
@@ -983,6 +983,7 @@ int avio_close_dyn_buf(AVIOContext *s, uint8_t **pbuffer)
 
     avio_flush(s);
 
+    d = s->opaque;
     *pbuffer = d->buffer;
     size = d->size;
     av_free(d);