OSDN Git Service

avparser: don't av_malloc(0).
authorRonald S. Bultje <rbultje@google.com>
Wed, 27 Apr 2011 01:46:08 +0000 (18:46 -0700)
committerMichael Niedermayer <michaelni@gmx.at>
Wed, 27 Apr 2011 02:20:55 +0000 (04:20 +0200)
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavcodec/parser.c

index c1c8ce2..b5c34df 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);