Commit Diff


commit - cc3ce05962c0e173176dd8fa1a545daded616853
commit + 6c685612338950f89dc47cd0ef36bcd65fe6404f
blob - 64550af73ca34b53669e898b8d6008418d6a3c20
blob + 4afeb87f0f5086b887285255029b2bfc2ed97b5e
--- tog/tog.c
+++ tog/tog.c
@@ -2834,6 +2834,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 :
 		    "........................................",
@@ -2910,6 +2913,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 */