commit ca008b32c0b3792a048ac9f57dd80f37e90c9200 from: Stefan Sperling date: Sun Jul 22 13:38:50 2018 UTC fix leak in got_object_open_by_path() commit - fcc85cad4890e3f30b1e1d4e07c46d0fae1d9c61 commit + ca008b32c0b3792a048ac9f57dd80f37e90c9200 blob - 73fbb64e2208b4479a4d74bf5b63fdaa5a3540f3 blob + eb8d9b42d58aed00b8c4a6384f1b0797512230ef --- lib/object.c +++ lib/object.c @@ -1541,9 +1541,7 @@ got_object_open_by_path(struct got_object **obj, struc /* Handle opening of root of commit's tree. */ if (path[1] == '\0') { err = got_object_open(obj, repo, commit->tree_id); - if (err) - goto done; - return NULL; + goto done; } err = got_object_open_as_tree(&tree, repo, commit->tree_id); @@ -1599,11 +1597,9 @@ got_object_open_by_path(struct got_object **obj, struc } } - if (te) { + if (te) err = got_object_open(obj, repo, te->id); - if (err) - goto done; - } else + else err = got_error(GOT_ERR_NO_OBJ); done: free(s0);