]> git.sesse.net Git - ffmpeg/commitdiff
Fix avisynth_context_create constructor error handling.
authord s <avxsynth-testing@gmail.com>
Wed, 27 Mar 2013 02:36:18 +0000 (19:36 -0700)
committerMichael Niedermayer <michaelni@gmx.at>
Wed, 27 Mar 2013 02:47:49 +0000 (03:47 +0100)
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavformat/avisynth.c

index d31031dd157427903967fc54e643e763f0d81ec8..3119a45204ede794c3f4b4a30f1c66b75b8f3a8c 100644 (file)
@@ -164,26 +164,22 @@ static av_cold int avisynth_context_create(AVFormatContext *s) {
             return ret;
     }
 
-    if (!avs)
-        return AVERROR_UNKNOWN;
-
-    if (!avs_ctx_list) {
-        avs_ctx_list = avs;
-    } else {
-        avs->next = avs_ctx_list;
-        avs_ctx_list = avs;
-    }
-
     avs->env = avs_library->avs_create_script_environment(3);
     if (avs_library->avs_get_error) {
         const char *error = avs_library->avs_get_error(avs->env);
         if (error) {
             av_log(s, AV_LOG_ERROR, "%s\n", error);
-            av_free(avs);
             return AVERROR_UNKNOWN;
         }
     }
 
+    if (!avs_ctx_list) {
+        avs_ctx_list = avs;
+    } else {
+        avs->next = avs_ctx_list;
+        avs_ctx_list = avs;
+    }
+
     return 0;
 }