Commit Diff


commit - 8cf2cdaa9e11ecebdd1142af9539c45b2d33556b
commit + 6c37ad7bc12ab6573fdad7e54b1ae0a4d74e5dbf
blob - 3bdfc28736918a09e42ed18997bdbdfd6ed7b0a5
blob + 66f5cf734705a750a9156561f25c4f0318f2224e
--- gotwebd/gotweb.c
+++ gotwebd/gotweb.c
@@ -353,14 +353,17 @@ gotweb_init_querystring(struct querystring **qs)
 	if (*qs == NULL)
 		return got_error_from_errno2("%s: calloc", __func__);
 
-	(*qs)->action = INDEX;
-	(*qs)->commit = NULL;
-	(*qs)->file = NULL;
-	(*qs)->folder = NULL;
 	(*qs)->headref = strdup("HEAD");
 	if ((*qs)->headref == NULL) {
+		free(*qs);
+		*qs = NULL;
 		return got_error_from_errno2("%s: strdup", __func__);
 	}
+
+	(*qs)->action = INDEX;
+	(*qs)->commit = NULL;
+	(*qs)->file = NULL;
+	(*qs)->folder = NULL;
 	(*qs)->index_page = 0;
 	(*qs)->index_page_str = NULL;
 	(*qs)->path = NULL;