Prechádzať zdrojové kódy

Reset user connection data when closing the connection

bel2125 8 rokov pred
rodič
commit
125cc06a8b
1 zmenil súbory, kde vykonal 5 pridanie a 0 odobranie
  1. 5 0
      src/civetweb.c

+ 5 - 0
src/civetweb.c

@@ -14193,6 +14193,11 @@ close_connection(struct mg_connection *conn)
 		conn->ctx->callbacks.connection_close(conn);
 	}
 
+	/* Reset user data, after close callback is called.
+	 * Do not reuse it. If the user needs a destructor,
+	 * it must be done in the connection_close callback. */
+	mg_set_user_connection_data(conn, NULL);
+
 	mg_lock_connection(conn);
 
 	conn->must_close = 1;