Commit Diff


commit - 49f76ad0c2bd708657aeec16ca8a330dac21ddca
commit + 5bedd79b0a5ac6601216ed43d3b71bd038c7e563
blob - 55eb6fc3bb3a107437298c1dcb8035cfdaa747b5
blob + 57d449d06d25846b04b67a4520bef7ed129af84b
--- got/got.c
+++ got/got.c
@@ -11744,16 +11744,16 @@ histedit_parse_list(struct got_histedit_list *histedit
 {
 	const struct got_error *err = NULL;
 	char *line = NULL, *p, *end;
-	size_t i, size;
-	ssize_t len;
+	size_t i, linesize = 0;
+	ssize_t linelen;
 	int lineno = 0, lastcmd = -1;
 	const struct got_histedit_cmd *cmd;
 	struct got_object_id *commit_id = NULL;
 	struct got_histedit_list_entry *hle = NULL;
 
 	for (;;) {
-		len = getline(&line, &size, f);
-		if (len == -1) {
+		linelen = getline(&line, &linesize, f);
+		if (linelen == -1) {
 			const struct got_error *getline_err;
 			if (feof(f))
 				break;
@@ -11765,11 +11765,8 @@ histedit_parse_list(struct got_histedit_list *histedit
 		p = line;
 		while (isspace((unsigned char)p[0]))
 			p++;
-		if (p[0] == '#' || p[0] == '\0') {
-			free(line);
-			line = NULL;
+		if (p[0] == '#' || p[0] == '\0')
 			continue;
-		}
 		cmd = NULL;
 		for (i = 0; i < nitems(got_histedit_cmds); i++) {
 			cmd = &got_histedit_cmds[i];
@@ -11806,8 +11803,6 @@ histedit_parse_list(struct got_histedit_list *histedit
 					break;
 				}
 			}
-			free(line);
-			line = NULL;
 			lastcmd = cmd->code;
 			continue;
 		} else {
@@ -11832,8 +11827,6 @@ histedit_parse_list(struct got_histedit_list *histedit
 		hle->commit_id = commit_id;
 		hle->logmsg = NULL;
 		commit_id = NULL;
-		free(line);
-		line = NULL;
 		TAILQ_INSERT_TAIL(histedit_cmds, hle, entry);
 		lastcmd = cmd->code;
 	}