Commit Diff


commit - cabb4cfd832114dd19f9e48a7640a7527dc4f755
commit + 00580e07010e9d6aab00f67b628381ca81f19def
blob - ab7c78110dac1b93b89f66c336531f2f7f1e4fee
blob + 229ab62ccf36a2c9ae3a6b9dd3c953a0c0f7f184
--- tog/tog.c
+++ tog/tog.c
@@ -2838,6 +2838,9 @@ draw_commits(struct tog_view *view)
 		}
 	}
 
+	free(refs_str);
+	refs_str = NULL;
+
 	if (s->in_repo_path && strcmp(s->in_repo_path, "/") != 0) {
 		if (asprintf(&header, "commit %s %s%s", id_str ? id_str :
 		    "........................................",
@@ -2914,6 +2917,8 @@ draw_commits(struct tog_view *view)
 			err = format_line(&ws, &width, NULL, refs_str,
 			    0, INT_MAX, date_display_cols + author_cols, 0);
 			free(ws);
+			free(refs_str);
+			refs_str = NULL;
 			if (err)
 				goto done;
 			refstr_cols = width + 3; /* account for [ ] + space */