[FFmpeg-cvslog] avparser: don't av_malloc(0).

Ronald S. Bultje git at videolan.org
Wed Apr 27 04:22:29 CEST 2011


ffmpeg | branch: master | Ronald S. Bultje <rbultje at google.com> | Tue Apr 26 18:46:08 2011 -0700| [191e08d113ef1d089c45c5fb6c95491e16dde86e] | committer: Michael Niedermayer

avparser: don't av_malloc(0).

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

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

 libavcodec/parser.c |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/libavcodec/parser.c b/libavcodec/parser.c
index c1c8ce2..b5c34df 100644
--- a/libavcodec/parser.c
+++ b/libavcodec/parser.c
@@ -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);



More information about the ffmpeg-cvslog mailing list