Pārlūkot izejas kodu

Update mongoose.c

when having connections with and without auth would cause double free and then crash
Hendrik Polczynski 12 gadi atpakaļ
vecāks
revīzija
fdef2b8643
1 mainītis faili ar 1 papildinājumiem un 0 dzēšanām
  1. 1 0
      mongoose.c

+ 1 - 0
mongoose.c

@@ -5017,6 +5017,7 @@ static void process_new_connection(struct mg_connection *conn) {
     }
     }
     if (ri->remote_user != NULL) {
     if (ri->remote_user != NULL) {
       free((void *) ri->remote_user);
       free((void *) ri->remote_user);
+      ri->remote_user = NULL; // when having connections with and without auth would cause double free and then crash
     }
     }
 
 
     // NOTE(lsm): order is important here. should_keep_alive() call
     // NOTE(lsm): order is important here. should_keep_alive() call