avformat/asfenc: Check for index_ptr allocation failure
authorMichael Niedermayer <michaelni@gmx.at>
Tue, 7 Apr 2015 20:29:54 +0000 (22:29 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Tue, 7 Apr 2015 20:29:54 +0000 (22:29 +0200)
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavformat/asfenc.c

index 5e0f7b0..015c731 100644 (file)
@@ -652,6 +652,8 @@ static int asf_write_header(AVFormatContext *s)
     asf->nb_packets = 0;
 
     asf->index_ptr             = av_malloc(sizeof(ASFIndex) * ASF_INDEX_BLOCK);
+    if (!asf->index_ptr)
+        return AVERROR(ENOMEM);
     asf->nb_index_memory_alloc = ASF_INDEX_BLOCK;
     asf->maximum_packet        = 0;