[FFmpeg-cvslog] ffprobe: set writer context to 0 after allocation

Stefano Sabatini git at videolan.org
Tue Mar 19 18:01:23 CET 2013


ffmpeg | branch: master | Stefano Sabatini <stefasab at gmail.com> | Tue Mar 19 17:57:50 2013 +0100| [e292d75113fdcb28dcd76321771ec139393af35e] | committer: Stefano Sabatini

ffprobe: set writer context to 0 after allocation

Avoid access to uninitialized values, which may result in a crash.

This happens for example in case of option parsing failure, since in that
case the internal AVBprint buffers are not initialized.

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

 ffprobe.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ffprobe.c b/ffprobe.c
index ef9bef4..4d2d3e1 100644
--- a/ffprobe.c
+++ b/ffprobe.c
@@ -300,7 +300,7 @@ static int writer_open(WriterContext **wctx, const Writer *writer, const char *a
 {
     int i, ret = 0;
 
-    if (!(*wctx = av_malloc(sizeof(WriterContext)))) {
+    if (!(*wctx = av_mallocz(sizeof(WriterContext)))) {
         ret = AVERROR(ENOMEM);
         goto fail;
     }



More information about the ffmpeg-cvslog mailing list