aboutsummaryrefslogtreecommitdiff
path: root/fcgiwrap.c
diff options
context:
space:
mode:
authorFurkan Sahin <furkan-dev@proton.me>2014-08-15 09:41:37 +0200
committerFurkan Sahin <furkan-dev@proton.me>2014-08-15 09:41:37 +0200
commit8c1b7e8aa49fd2d59bee5d3e4b6766a81ec847a2 (patch)
treeca40b94780b10b8a37222ea0b5c5e089463e5487 /fcgiwrap.c
parent4327b4162ca79a98fce7fcf82f138c7a86758780 (diff)
Use-after-free fix
Diffstat (limited to 'fcgiwrap.c')
-rw-r--r--fcgiwrap.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/fcgiwrap.c b/fcgiwrap.c
index a2c88af..3c36cf7 100644
--- a/fcgiwrap.c
+++ b/fcgiwrap.c
@@ -853,7 +853,6 @@ int main(int argc, char **argv)
if (setup_socket(socket_url, &fd) < 0) {
return 1;
}
- free(socket_url);
}
prefork(nchildren);
@@ -863,9 +862,12 @@ int main(int argc, char **argv)
const char *p = socket_url;
close(fd);
- if (!strncmp(p, "unix:", sizeof("unix:") - 1)) {
- p += sizeof("unix:") - 1;
- unlink(p);
+ if(socket_url) {
+ if (!strncmp(p, "unix:", sizeof("unix:") - 1)) {
+ p += sizeof("unix:") - 1;
+ unlink(p);
+ }
+ free(socket_url);
}
}
return 0;