Commit 4f1a8200c610fa751d18ba5026ad429a0ca35a06

Stefan Sperling 2018-05-08T09:07:46

fix potential crash in tog(1)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
diff --git a/tog/tog.c b/tog/tog.c
index 15126bb..a7e3024 100644
--- a/tog/tog.c
+++ b/tog/tog.c
@@ -422,7 +422,6 @@ show_log_view(struct got_object_id *start_id, struct got_repository *repo)
 				entry = TAILQ_LAST(&commits, commit_queue);
 				if (entry->commit->nparents == 0)
 					break;
-				got_object_close(obj);
 				pop_commit(&commits);
 				if (TAILQ_EMPTY(&commits)) {
 					refetch_commits = 1;
@@ -434,6 +433,7 @@ show_log_view(struct got_object_id *start_id, struct got_repository *repo)
 					err = got_error_from_errno();
 					goto done;
 				}
+				got_object_close(obj);
 				err = got_object_open(&obj, repo, id);
 				if (err)
 					return err;