]> git.sesse.net Git - ffmpeg/blobdiff - libavformat/options.c
avformat/hlsenc: free the original malloc pointer to avoid error when system function...
[ffmpeg] / libavformat / options.c
index c188c23506a20b8a3c545f53b086b9d671bee891..e14510504f7ca6e3079a9ad879ec4b6f675d37fe 100644 (file)
@@ -144,15 +144,17 @@ static void avformat_get_context_defaults(AVFormatContext *s)
 AVFormatContext *avformat_alloc_context(void)
 {
     AVFormatContext *ic;
+    AVFormatInternal *internal;
     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);
+    internal = av_mallocz(sizeof(*internal));
+    if (!internal) {
+        av_free(ic);
         return NULL;
     }
+    avformat_get_context_defaults(ic);
+    ic->internal = internal;
     ic->internal->offset = AV_NOPTS_VALUE;
     ic->internal->raw_packet_buffer_remaining_size = RAW_PACKET_BUFFER_SIZE;
     ic->internal->shortest_end = AV_NOPTS_VALUE;