commit: use xstrdup() in get_merge_parent()
authorRené Scharfe <l.s.r@web.de>
Sat, 13 Aug 2016 12:09:49 +0000 (14:09 +0200)
committerJunio C Hamano <gitster@pobox.com>
Sun, 14 Aug 2016 02:47:49 +0000 (19:47 -0700)
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>
commit.c
index 2a90e37519f0b6e9de6e30ed57afe91822441ca3..dd955e3e299a0b5e04db13ad20a10c3985b56093 100644 (file)
--- a/commit.c
+++ b/commit.c
@@ -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;