Commit c2f16475fd622a4c9490402b7918f9991c407aa1

Stefan Sperling 2018-07-23T18:09:18

fix leaks in queue_commits()

diff --git a/tog/tog.c b/tog/tog.c
index 445f746..d84bf2d 100644
--- a/tog/tog.c
+++ b/tog/tog.c
@@ -416,10 +416,23 @@ queue_commits(struct got_commit_graph *graph, struct commit_queue *commits,
 					err = NULL;
 					changed = 1;
 				} else {
-					changed = (got_object_id_cmp(
-					    got_object_get_id(obj),
-					    got_object_get_id(pobj)) != 0);
+					struct got_object_id *id, *pid;
+					id = got_object_get_id(obj);
+					if (id == NULL) {
+						err = got_error_from_errno();
+						break;
+					}
+					pid = got_object_get_id(pobj);
+					if (pid == NULL) {
+						err = got_error_from_errno();
+						free(id);
+						break;
+					}
+					changed =
+					    (got_object_id_cmp(id, pid) != 0);
 					got_object_close(pobj);
+					free(id);
+					free(pid);
 				}
 			}
 			if (!changed) {