Commit 835e0dbdc83dcd863487243b581bdb1055f50855

Stefan Sperling 2018-06-21T23:42:37

init output param of got_object_open_as_*

diff --git a/lib/object.c b/lib/object.c
index 3bf9f60..92f261b 100644
--- a/lib/object.c
+++ b/lib/object.c
@@ -448,6 +448,8 @@ got_object_open_as_commit(struct got_commit_object **commit,
 	const struct got_error *err;
 	struct got_object *obj;
 
+	*commit = NULL;
+
 	err = got_object_open(&obj, repo, id);
 	if (err)
 		return err;
@@ -1132,6 +1134,8 @@ got_object_open_as_tree(struct got_tree_object **tree,
 	const struct got_error *err;
 	struct got_object *obj;
 
+	*tree = NULL;
+
 	err = got_object_open(&obj, repo, id);
 	if (err)
 		return err;
@@ -1328,6 +1332,8 @@ got_object_open_as_blob(struct got_blob_object **blob,
 	const struct got_error *err;
 	struct got_object *obj;
 
+	*blob = NULL;
+
 	err = got_object_open(&obj, repo, id);
 	if (err)
 		return err;