diff options
author | Ferry Huberts | 2011-03-09 08:16:59 +0100 |
---|---|---|
committer | Lars Hjemli | 2011-03-26 15:13:35 +0100 |
commit | 5db02854e64fa41aa459ea7d13fc827063deda41 (patch) | |
tree | 8db8d588e5d1f2bf3ede996e5907569389677eb8 /cgit.c | |
parent | 3f1ebd3565afa33196dfc3e8584e04564987e33c (diff) | |
download | cgit-5db02854e64fa41aa459ea7d13fc827063deda41.tar.gz cgit-5db02854e64fa41aa459ea7d13fc827063deda41.tar.bz2 cgit-5db02854e64fa41aa459ea7d13fc827063deda41.zip |
new_filter: correctly initialise all arguments for a new filter
Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Diffstat (limited to 'cgit.c')
-rw-r--r-- | cgit.c | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -29,15 +29,17 @@ void add_mimetype(const char *name, const char *value) | |||
29 | struct cgit_filter *new_filter(const char *cmd, int extra_args) | 29 | struct cgit_filter *new_filter(const char *cmd, int extra_args) |
30 | { | 30 | { |
31 | struct cgit_filter *f; | 31 | struct cgit_filter *f; |
32 | int args_size = 0; | ||
32 | 33 | ||
33 | if (!cmd || !cmd[0]) | 34 | if (!cmd || !cmd[0]) |
34 | return NULL; | 35 | return NULL; |
35 | 36 | ||
36 | f = xmalloc(sizeof(struct cgit_filter)); | 37 | f = xmalloc(sizeof(struct cgit_filter)); |
37 | f->cmd = xstrdup(cmd); | 38 | f->cmd = xstrdup(cmd); |
38 | f->argv = xmalloc((2 + extra_args) * sizeof(char *)); | 39 | args_size = (2 + extra_args) * sizeof(char *); |
40 | f->argv = xmalloc(args_size); | ||
41 | memset(f->argv, 0, args_size); | ||
39 | f->argv[0] = f->cmd; | 42 | f->argv[0] = f->cmd; |
40 | f->argv[1] = NULL; | ||
41 | return f; | 43 | return f; |
42 | } | 44 | } |
43 | 45 | ||