about summary refs log tree commit diff
path: root/surf.c
diff options
context:
space:
mode:
authorChristoph Lohmann <20h@r-36.net>2014-02-06 06:47:22 +0100
committerChristoph Lohmann <20h@r-36.net>2014-02-06 06:47:22 +0100
commit127dc366efeda9afc6086be67b60979af1d71205 (patch)
tree9175e6153ea8e306dbd8ced46d5b4eda85cfb9d2 /surf.c
parentMaking the empty title possible. (diff)
downloadsurf-127dc366efeda9afc6086be67b60979af1d71205.tar.gz
surf-127dc366efeda9afc6086be67b60979af1d71205.tar.bz2
surf-127dc366efeda9afc6086be67b60979af1d71205.zip
Removing a memory leak when u wasn't freed.
Diffstat (limited to 'surf.c')
-rw-r--r--surf.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/surf.c b/surf.c
index c598404..1ec4c62 100644
--- a/surf.c
+++ b/surf.c
@@ -656,7 +656,7 @@ loadstatuschange(WebKitWebView *view, GParamSpec *pspec, Client *c) {
 
 static void
 loaduri(Client *c, const Arg *arg) {
-	char *u, *rp;
+	char *u = NULL, *rp;
 	const char *uri = (char *)arg->v;
 	Arg a = { .b = FALSE };
 	struct stat st;
@@ -683,9 +683,10 @@ loaduri(Client *c, const Arg *arg) {
 		webkit_web_view_load_uri(c->view, u);
 		c->progress = 0;
 		c->title = copystr(&c->title, u);
-		g_free(u);
 		updatetitle(c);
 	}
+	if(u != NULL)
+		g_free(u);
 }
 
 static void