commit: use xstrdup() in get_merge_parent()

Handle allocation errors for the name member just like we already do
for the struct merge_remote_desc itself.

Signed-off-by: Rene Scharfe <l.s.r@web.de>
Reviewed-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
René Scharfe 2016-08-13 14:09:49 +02:00 committed by Junio C Hamano
parent e0c1ceafc5
commit c089320cf6

View File

@ -1589,7 +1589,7 @@ struct commit *get_merge_parent(const char *name)
struct merge_remote_desc *desc;
desc = xmalloc(sizeof(*desc));
desc->obj = obj;
desc->name = strdup(name);
desc->name = xstrdup(name);
commit->util = desc;
}
return commit;