diff options
| -rw-r--r-- | browser-cli.c | 4 | ||||
| -rw-r--r-- | server.c | 7 |
2 files changed, 9 insertions, 2 deletions
diff --git a/browser-cli.c b/browser-cli.c index d3d4c2f..3bea4ba 100644 --- a/browser-cli.c +++ b/browser-cli.c @@ -140,7 +140,9 @@ int handleCLI(sds *host, sds *port, sds *uri, const sds page) { // Handle relative URLs if (startPath == newURI) { - newURI = sdscatsds(sdsnewlen(*uri, findBeginningOfPath(*uri) - *uri), newURI); + sds beforePath = sdscatsds(sdsnewlen(*uri, findBeginningOfPath(*uri) - *uri), newURI); + sdsfree(newURI); + newURI = beforePath; startPath = findBeginningOfPath(newURI); } @@ -102,7 +102,8 @@ int main(int argc, char* argv[]) { close(fd_socket); handleCLI(vhosts, vhostsc); freeVhosts(vhosts, vhostsc); - //while(wait(NULL) > 0); + sdsfree(host); + sdsfree(port); return 0; } @@ -169,6 +170,8 @@ int main(int argc, char* argv[]) { on_connection(strAddr, fd_client, vhosts, argc - 1); close(fd_client); freeVhosts(vhosts, vhostsc); + sdsfree(host); + sdsfree(port); return 0; } close(fd_client); @@ -177,4 +180,6 @@ int main(int argc, char* argv[]) { while(wait(NULL) > 0); freeVhosts(vhosts, vhostsc); close(fd_socket); + sdsfree(host); + sdsfree(port); } |
