Explorar o código

Not leaking socket in set ports option

Sergey Lyubka %!s(int64=12) %!d(string=hai) anos
pai
achega
ab16220861
Modificáronse 1 ficheiros con 1 adicións e 0 borrados
  1. 1 0
      mongoose.c

+ 1 - 0
mongoose.c

@@ -4576,6 +4576,7 @@ static int set_ports_option(struct mg_context *ctx) {
     } else if ((ptr = realloc(ctx->listening_sockets,
                               (ctx->num_listening_sockets + 1) *
                               sizeof(ctx->listening_sockets[0]))) == NULL) {
+      closesocket(so.sock);
       success = 0;
     } else {
       set_close_on_exec(so.sock);