From 5db02854e64fa41aa459ea7d13fc827063deda41 Mon Sep 17 00:00:00 2001 From: Ferry Huberts Date: Wed, 9 Mar 2011 08:16:59 +0100 Subject: new_filter: correctly initialise all arguments for a new filter Signed-off-by: Ferry Huberts Signed-off-by: Lars Hjemli --- cgit.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'cgit.c') diff --git a/cgit.c b/cgit.c index f4dd6ef..e302a7c 100644 --- a/cgit.c +++ b/cgit.c @@ -29,15 +29,17 @@ void add_mimetype(const char *name, const char *value) struct cgit_filter *new_filter(const char *cmd, int extra_args) { struct cgit_filter *f; + int args_size = 0; if (!cmd || !cmd[0]) return NULL; f = xmalloc(sizeof(struct cgit_filter)); f->cmd = xstrdup(cmd); - f->argv = xmalloc((2 + extra_args) * sizeof(char *)); + args_size = (2 + extra_args) * sizeof(char *); + f->argv = xmalloc(args_size); + memset(f->argv, 0, args_size); f->argv[0] = f->cmd; - f->argv[1] = NULL; return f; } -- cgit v1.2.3-70-g09d2