[FFmpeg-cvslog] examples/avio_reading: fix null dereference on error

Michael Niedermayer git at videolan.org
Thu Apr 10 05:08:40 CEST 2014


ffmpeg | branch: release/2.2 | Michael Niedermayer <michaelni at gmx.at> | Sun Apr  6 00:39:58 2014 +0200| [34592d04fbeaf3dc993650f1fcf54ed76af9b26b] | committer: Michael Niedermayer

examples/avio_reading: fix null dereference on error

Fixed CID1197052
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
(cherry picked from commit 419800acc46afc0c3b7319d6e216d0da207ebbb7)

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

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

 doc/examples/avio_reading.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/doc/examples/avio_reading.c b/doc/examples/avio_reading.c
index 45dbd47..02474e9 100644
--- a/doc/examples/avio_reading.c
+++ b/doc/examples/avio_reading.c
@@ -119,8 +119,10 @@ int main(int argc, char *argv[])
 end:
     avformat_close_input(&fmt_ctx);
     /* note: the internal buffer could have changed, and be != avio_ctx_buffer */
-    av_freep(&avio_ctx->buffer);
-    av_freep(&avio_ctx);
+    if (avio_ctx) {
+        av_freep(&avio_ctx->buffer);
+        av_freep(&avio_ctx);
+    }
     av_file_unmap(buffer, buffer_size);
 
     if (ret < 0) {



More information about the ffmpeg-cvslog mailing list