Commit cdb8f1fa33c26cc381af648690c3f8cc4380175f

Hiltjo Posthuma 2019-08-28T18:50:20

fix possible NULL deref in alloc_symref()

1
2
3
4
5
6
7
8
9
10
11
12
diff --git a/lib/reference.c b/lib/reference.c
index c175b73..54de181 100644
--- a/lib/reference.c
+++ b/lib/reference.c
@@ -123,6 +123,7 @@ alloc_symref(struct got_reference **ref, const char *name,
 		err = got_error_from_errno("strdup");
 		got_ref_close(*ref);
 		*ref = NULL;
+		return err;
 	}
 	(*ref)->ref.symref.ref = strdup(target_ref);
 	if ((*ref)->ref.symref.ref == NULL) {