[mod_fastcgi,mod_scgi] fix resource leaks on spawning backends

From: Stefan Bühler <stbuehler@web.de>

git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2942 152afb58-edef-0310-8abb-c4023f1b3aa9
svn/tags/lighttpd-1.4.35
Stefan Bühler 9 years ago
parent d59c910d6a
commit b461e031f5
  1. 1
      NEWS
  2. 3
      src/mod_fastcgi.c
  3. 4
      src/mod_scgi.c

@ -8,6 +8,7 @@ NEWS
* [mod_fastcgi] fix use after free (only triggered if fastcgi debug is active)
* [mod_rrdtool] fix invalid read (string not null terminated)
* [mod_dirlisting] fix memory leak if pcre fails
* [mod_fastcgi,mod_scgi] fix resource leaks on spawning backends
- 1.4.34
* [mod_auth] explicitly link ssl for SHA1 (fixes #2517)

@ -969,6 +969,7 @@ static int fcgi_spawn_connection(server *srv,
if (setsockopt(fcgi_fd, SOL_SOCKET, SO_REUSEADDR, &val, sizeof(val)) < 0) {
log_error_write(srv, __FILE__, __LINE__, "ss",
"socketsockopt failed:", strerror(errno));
close(fcgi_fd);
return -1;
}
@ -978,12 +979,14 @@ static int fcgi_spawn_connection(server *srv,
"bind failed for:",
proc->connection_name,
strerror(errno));
close(fcgi_fd);
return -1;
}
if (-1 == listen(fcgi_fd, 1024)) {
log_error_write(srv, __FILE__, __LINE__, "ss",
"listen failed:", strerror(errno));
close(fcgi_fd);
return -1;
}

@ -752,6 +752,7 @@ static int scgi_spawn_connection(server *srv,
if (setsockopt(scgi_fd, SOL_SOCKET, SO_REUSEADDR, &val, sizeof(val)) < 0) {
log_error_write(srv, __FILE__, __LINE__, "ss",
"socketsockopt failed:", strerror(errno));
close(scgi_fd);
return -1;
}
@ -762,12 +763,14 @@ static int scgi_spawn_connection(server *srv,
proc->socket,
proc->port,
strerror(errno));
close(scgi_fd);
return -1;
}
if (-1 == listen(scgi_fd, 1024)) {
log_error_write(srv, __FILE__, __LINE__, "ss",
"listen failed:", strerror(errno));
close(scgi_fd);
return -1;
}
@ -2997,6 +3000,7 @@ TRIGGER_FUNC(mod_scgi_handle_trigger) {
if (scgi_spawn_connection(srv, p, host, fp)) {
log_error_write(srv, __FILE__, __LINE__, "s",
"ERROR: spawning fcgi failed.");
scgi_process_free(fp);
return HANDLER_ERROR;
}

Loading…
Cancel
Save