summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJérémie Courrèges-Anglas <jca@wxcvbn.org>2014-03-24 10:10:18 +0100
committerJérémie Courrèges-Anglas <jca@wxcvbn.org>2014-03-24 10:24:02 +0100
commite8f1cd328f9c15e2b1814962e2728d86a1565658 (patch)
tree0975764a4998321f03a0d4b453972ce3b03bf626
parenta2be2e6514801fe3f6829a05de017840f50a2b3e (diff)
downloadratpoison-e8f1cd328f9c15e2b1814962e2728d86a1565658.zip
Avoid malloc(0) in add_command.
-rw-r--r--src/actions.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/actions.c b/src/actions.c
index 07aeff9..a7466e0 100644
--- a/src/actions.c
+++ b/src/actions.c
@@ -171,7 +171,7 @@ add_command (char *name, cmdret * (*fn)(int, struct cmdarg **), int nargs, int i
cmd->num_args = nargs;
cmd->ni_required_args = ni_nrequired;
cmd->i_required_args = i_nrequired;
- cmd->args = xmalloc(sizeof(struct argspec) * nargs);
+ cmd->args = nargs ? xmalloc (nargs * sizeof (struct argspec)) : NULL;
/* Fill cmd->args */
va_start(va, ni_nrequired);