]> git.sesse.net Git - ffmpeg/blobdiff - libavformat/options.c
matroskadec: Check memory allocations
[ffmpeg] / libavformat / options.c
index d99f04aab5bf3708aa147aa06431185718a1da8d..996dc31274ff1a2ba1f587f79e9e481bfbe1988a 100644 (file)
@@ -19,6 +19,7 @@
  */
 #include "avformat.h"
 #include "avio_internal.h"
+#include "internal.h"
 #include "libavutil/opt.h"
 
 /**
@@ -54,7 +55,7 @@ static const AVClass *format_child_class_next(const AVClass *prev)
     AVOutputFormat *ofmt = NULL;
 
     if (!prev)
-        return &ffio_url_class;
+        return &ff_avio_class;
 
     while ((ifmt = av_iformat_next(ifmt)))
         if (ifmt->priv_class == prev)
@@ -100,6 +101,14 @@ AVFormatContext *avformat_alloc_context(void)
     ic = av_malloc(sizeof(AVFormatContext));
     if (!ic) return ic;
     avformat_get_context_defaults(ic);
+
+    ic->internal = av_mallocz(sizeof(*ic->internal));
+    if (!ic->internal) {
+        avformat_free_context(ic);
+        return NULL;
+    }
+    ic->internal->offset = AV_NOPTS_VALUE;
+
     return ic;
 }