check_aliased_update(): check that dst_name is non-NULL

If there is an error in resolve_ref_unsafe(), it returns NULL. We check for this case, but not until after calling strip_namespace(). Instead, call strip_namespace() *after* the NULL check. Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: David Turner <dturner@twopensource.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Michael Haggerty committed Apr 7, 2016 at 15:03 UTC ded83936106a94f854873e949fa7928dce8dbdd1
1 file changed +1 -1
builtin/receive-pack.c
+1 -1
@@ -1081,13 +1081,13 @@ static void check_aliased_update(struct command *cmd, struct string_list *list)
1081 if (!(flag & REF_ISSYMREF))
1082 return;
1083
1084 - dst_name = strip_namespace(dst_name);
1084 if (!dst_name) {
1085 rp_error("refusing update to broken symref '%s'", cmd->ref_name);
1086 cmd->skip_update = 1;
1087 cmd->error_string = "broken symref";
1088 return;
1089 }
1090 + dst_name = strip_namespace(dst_name);
1091
1092 if ((item = string_list_lookup(list, dst_name)) == NULL)
1093 return;