Merge branch 'ps/plug-xdl-merge-leak' into maint
[gitweb.git] / help.c
diff --git a/help.c b/help.c
index d996b340669a66d0b1619472fedf5c11b940d7c5..19328ea992299d2b66b1b8de8a4a609a4d25388b 100644 (file)
--- a/help.c
+++ b/help.c
 
 void add_cmdname(struct cmdnames *cmds, const char *name, int len)
 {
-       struct cmdname *ent = xmalloc(sizeof(*ent) + len + 1);
-
+       struct cmdname *ent;
+       FLEX_ALLOC_MEM(ent, name, name, len);
        ent->len = len;
-       memcpy(ent->name, name, len);
-       ent->name[len] = 0;
 
        ALLOC_GROW(cmds->names, cmds->cnt + 1, cmds->alloc);
        cmds->names[cmds->cnt++] = ent;