avparser: don't av_malloc(0).
authorRonald S. Bultje <rbultje@google.com>
Wed, 27 Apr 2011 01:46:08 +0000 (18:46 -0700)
committerRonald S. Bultje <rsbultje@gmail.com>
Wed, 27 Apr 2011 05:07:17 +0000 (22:07 -0700)
Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
libavcodec/parser.c

index d5b85c3..4b3d30e 100644 (file)
@@ -58,10 +58,12 @@ AVCodecParserContext *av_parser_init(int codec_id)
     if (!s)
         return NULL;
     s->parser = parser;
-    s->priv_data = av_mallocz(parser->priv_data_size);
-    if (!s->priv_data) {
-        av_free(s);
-        return NULL;
+    if (parser->priv_data_size) {
+        s->priv_data = av_mallocz(parser->priv_data_size);
+        if (!s->priv_data) {
+            av_free(s);
+            return NULL;
+        }
     }
     if (parser->parser_init) {
         ret = parser->parser_init(s);