]> git.cameronkatri.com Git - cgit.git/commitdiff
new_filter: correctly initialise all arguments for a new filter
authorFerry Huberts <ferry.huberts@pelagic.nl>
Wed, 9 Mar 2011 07:16:59 +0000 (08:16 +0100)
committerLars Hjemli <hjemli@gmail.com>
Sat, 26 Mar 2011 14:13:35 +0000 (15:13 +0100)
Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
cgit.c

diff --git a/cgit.c b/cgit.c
index f4dd6ef93c4b1b73d1583df8cab06627e34ae491..e302a7c8c387cf096a4f387792c41223cc048b01 100644 (file)
--- 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;
 }