avformat/ftp: fix possible deadlock
authorLukasz Marek <lukasz.m.luki@gmail.com>
Sat, 12 Oct 2013 10:53:54 +0000 (12:53 +0200)
committerLukasz Marek <lukasz.m.luki@gmail.com>
Sat, 12 Oct 2013 11:52:33 +0000 (13:52 +0200)
Signed-off-by: Lukasz Marek <lukasz.m.luki@gmail.com>
libavformat/ftp.c

index eb3827f..aaa9410 100644 (file)
@@ -486,14 +486,13 @@ static int ftp_abort(URLContext *h)
         }
     } else {
         ftp_close_data_connection(s);
-    }
-
-    if (ftp_status(s, NULL, abor_codes) < 225) {
-        /* wu-ftpd also closes control connection after data connection closing */
-        ffurl_closep(&s->conn_control);
-        if ((err = ftp_connect_control_connection(h)) < 0) {
-            av_log(h, AV_LOG_ERROR, "Reconnect failed.\n");
-            return err;
+        if (ftp_status(s, NULL, abor_codes) < 225) {
+            /* wu-ftpd also closes control connection after data connection closing */
+            ffurl_closep(&s->conn_control);
+            if ((err = ftp_connect_control_connection(h)) < 0) {
+                av_log(h, AV_LOG_ERROR, "Reconnect failed.\n");
+                return err;
+            }
         }
     }