avio: check AVIOContext malloc failure
authorCan Wu <wu.canus@gmail.com>
Sat, 14 May 2011 09:27:31 +0000 (17:27 +0800)
committerAnton Khirnov <anton@khirnov.net>
Sat, 21 May 2011 11:42:50 +0000 (13:42 +0200)
Signed-off-by: Anton Khirnov <anton@khirnov.net>
libavformat/aviobuf.c

index 2b14d48..fa63ddf 100644 (file)
@@ -113,6 +113,8 @@ AVIOContext *avio_alloc_context(
                   int64_t (*seek)(void *opaque, int64_t offset, int whence))
 {
     AVIOContext *s = av_mallocz(sizeof(AVIOContext));
+    if (!s)
+        return NULL;
     ffio_init_context(s, buffer, buffer_size, write_flag, opaque,
                   read_packet, write_packet, seek);
     return s;