author | Ferry Huberts <ferry.huberts@pelagic.nl> | 2011-03-09 07:16:59 (UTC) |
---|---|---|
committer | Lars Hjemli <hjemli@gmail.com> | 2011-03-26 14:13:35 (UTC) |
commit | 5db02854e64fa41aa459ea7d13fc827063deda41 (patch) (side-by-side diff) | |
tree | 8db8d588e5d1f2bf3ede996e5907569389677eb8 | |
parent | 3f1ebd3565afa33196dfc3e8584e04564987e33c (diff) | |
download | cgit-5db02854e64fa41aa459ea7d13fc827063deda41.zip cgit-5db02854e64fa41aa459ea7d13fc827063deda41.tar.gz cgit-5db02854e64fa41aa459ea7d13fc827063deda41.tar.bz2 |
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>
-rw-r--r-- | cgit.c | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -20,33 +20,35 @@ const char *cgit_version = CGIT_VERSION; void add_mimetype(const char *name, const char *value) { struct string_list_item *item; item = string_list_insert(&ctx.cfg.mimetypes, xstrdup(name)); item->util = xstrdup(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; } static void process_cached_repolist(const char *path); void repo_config(struct cgit_repo *repo, const char *name, const char *value) { if (!strcmp(name, "name")) repo->name = xstrdup(value); else if (!strcmp(name, "clone-url")) repo->clone_url = xstrdup(value); else if (!strcmp(name, "desc")) |