Commit 57b6f99ae52a3542d4cec0b74c1af6ff05d3e9c5

Stefan Sperling 2019-04-13T16:06:37

handle non-existent reference in got_ref_resolve() error path

1
2
3
4
5
6
7
8
9
10
11
12
13
14
diff --git a/lib/reference.c b/lib/reference.c
index 0a2b43b..f01bb78 100644
--- a/lib/reference.c
+++ b/lib/reference.c
@@ -511,7 +511,8 @@ got_ref_resolve(struct got_object_id **id, struct got_repository *repo,
 		err = resolve_symbolic_ref(&resolved, repo, ref);
 		if (err == NULL)
 			err = got_ref_resolve(id, repo, resolved);
-		got_ref_close(resolved);
+		if (resolved)
+			got_ref_close(resolved);
 		return err;
 	}