lavf: Avoid using av_malloc(0) in av_dump_format
authorMartin Storsjö <martin@martin.st>
Fri, 30 Sep 2011 17:30:35 +0000 (20:30 +0300)
committerMartin Storsjö <martin@martin.st>
Fri, 30 Sep 2011 19:31:30 +0000 (22:31 +0300)
On OS X, av_malloc(0) returns pointers that cause crashes when
freed.

Signed-off-by: Martin Storsjö <martin@martin.st>
libavformat/utils.c

index d0ad358..0ba6fc3 100644 (file)
@@ -3333,7 +3333,7 @@ void av_dump_format(AVFormatContext *ic,
                     int is_output)
 {
     int i;
-    uint8_t *printed = av_mallocz(ic->nb_streams);
+    uint8_t *printed = ic->nb_streams ? av_mallocz(ic->nb_streams) : NULL;
     if (ic->nb_streams && !printed)
         return;