about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorJosh Rickmar <jrick@devio.us>2013-05-01 12:07:46 -0400
committerJosh Rickmar <jrick@devio.us>2013-05-01 12:07:46 -0400
commit4133979e4dce1e25a5b8a8d429a259ca06693c58 (patch)
tree163d10e2d558c6b8bd2e9203005e7f9915cdad5a
parent2391894ab335c2dbe5ef63e55db94d1254cb296b (diff)
downloadxombrero-4133979e4dce1e25a5b8a8d429a259ca06693c58.tar.gz
Don't allow freeing NULL in open_tabs()
-rw-r--r--xombrero.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/xombrero.c b/xombrero.c
index 87c025c..ce5082c 100644
--- a/xombrero.c
+++ b/xombrero.c
@@ -1311,23 +1311,23 @@ open_tabs(struct tab *t, struct karg *a)
 		goto done;
 
 	for (;;) {
-		if ((uri = fparseln(f, NULL, NULL, "\0\0\0", 0)) == NULL)
+		if ((uri = fparseln(f, NULL, NULL, "\0\0\0", 0)) == NULL) {
 			if (feof(f) || ferror(f))
 				break;
+		} else {
+			/* retrieve session name */
+			if (g_str_has_prefix(uri, XT_SAVE_SESSION_ID)) {
+				strlcpy(named_session,
+				    &uri[strlen(XT_SAVE_SESSION_ID)],
+				    sizeof named_session);
+				continue;
+			}
 
-		/* retrieve session name */
-		if (uri && g_str_has_prefix(uri, XT_SAVE_SESSION_ID)) {
-			strlcpy(named_session,
-			    &uri[strlen(XT_SAVE_SESSION_ID)],
-			    sizeof named_session);
-			continue;
-		}
-
-		if (uri && strlen(uri))
-			create_new_tab(uri, NULL, 1, -1);
+			if (strlen(uri))
+				create_new_tab(uri, NULL, 1, -1);
 
-		free(uri);
-		uri = NULL;
+			free(uri);
+		}
 	}
 
 	/* close open tabs */