avparser: don't av_malloc(0).

Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
This commit is contained in:
Ronald S. Bultje 2011-04-26 18:46:08 -07:00 committed by Ronald S. Bultje
parent 79ee8977c2
commit 5eef4afb9a
1 changed files with 6 additions and 4 deletions

View 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);