Przeglądaj źródła

[FIX] fix free the same object twice problem

WKJay 5 lat temu
rodzic
commit
23e2e37dff
1 zmienionych plików z 3 dodań i 2 usunięć
  1. 3 2
      netserver.c

+ 3 - 2
netserver.c

@@ -478,15 +478,16 @@ static void netserver_handle(void *param) {
                             /* when user return -1, we close connection */
                             ns_session_close(mgr, new_conn);
                             new_conn = NULL;
+                            goto session_handle;
                         }
                     }
 #if NS_ENABLE_SSL
                     /* Do handshake */
                     if (mgr->flag & NS_USE_SSL) {
                         if (ns_ssl_if_handshake(mgr, new_conn) < 0) {
-                            NS_LOG("ssl handshake failed.");
                             ns_session_close(mgr, new_conn);
                             new_conn = NULL;
+                            goto session_handle;
                         }
                     }
 #endif
@@ -506,7 +507,7 @@ static void netserver_handle(void *param) {
                 netserver_accept_and_close(mgr);
             }
         }
-
+    session_handle:
         /* handle sessions */
         ns_session_handle(mgr, &tempreadfds, &tempexptfds);
     }