Website Summary Files Commits Branches @commit @diff @stats
path: root / browser-cli.c
diff options
context:
space:
mode:
1 files changed, 3 insertions, 1 deletions
-rw-r--r--browser-cli.c4
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);
}