diff options
author | Johan Ström <johan@stromnet.se> | 2014-08-15 09:41:37 +0200 |
---|---|---|
committer | Johan Ström <johan@stromnet.se> | 2014-08-15 09:41:37 +0200 |
commit | 5ad97b1c7eb853a921e0167e6bfcb6b1815b4fa4 (patch) | |
tree | ca40b94780b10b8a37222ea0b5c5e089463e5487 | |
parent | 99aedae9f611beffd11a448033bd8f72c069a3c4 (diff) | |
download | fcgiwrap-5ad97b1c7eb853a921e0167e6bfcb6b1815b4fa4.tar.xz fcgiwrap-5ad97b1c7eb853a921e0167e6bfcb6b1815b4fa4.zip |
Use-after-free fix
-rw-r--r-- | fcgiwrap.c | 10 |
1 files changed, 6 insertions, 4 deletions
@@ -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; |