Merge branch 'ek/alt-odb-entry-fix'
[gitweb.git] / builtin / receive-pack.c
index c3230817db4a7676eb74335b254f30597e66edd9..18458e81c6351d53afe1a50efff183889e5ab81b 100644 (file)
@@ -614,12 +614,9 @@ static void run_update_post_hook(struct command *commands)
        argv[0] = hook;
 
        for (argc = 1, cmd = commands; cmd; cmd = cmd->next) {
-               char *p;
                if (cmd->error_string || cmd->did_not_exist)
                        continue;
-               p = xmalloc(strlen(cmd->ref_name) + 1);
-               strcpy(p, cmd->ref_name);
-               argv[argc] = p;
+               argv[argc] = xstrdup(cmd->ref_name);
                argc++;
        }
        argv[argc] = NULL;