summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--cgit.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/cgit.c b/cgit.c
index f4dd6ef..e302a7c 100644
--- a/cgit.c
+++ b/cgit.c
@@ -20,33 +20,35 @@ const char *cgit_version = CGIT_VERSION;
20 20
21void add_mimetype(const char *name, const char *value) 21void add_mimetype(const char *name, const char *value)
22{ 22{
23 struct string_list_item *item; 23 struct string_list_item *item;
24 24
25 item = string_list_insert(&ctx.cfg.mimetypes, xstrdup(name)); 25 item = string_list_insert(&ctx.cfg.mimetypes, xstrdup(name));
26 item->util = xstrdup(value); 26 item->util = xstrdup(value);
27} 27}
28 28
29struct cgit_filter *new_filter(const char *cmd, int extra_args) 29struct 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
44static void process_cached_repolist(const char *path); 46static void process_cached_repolist(const char *path);
45 47
46void repo_config(struct cgit_repo *repo, const char *name, const char *value) 48void repo_config(struct cgit_repo *repo, const char *name, const char *value)
47{ 49{
48 if (!strcmp(name, "name")) 50 if (!strcmp(name, "name"))
49 repo->name = xstrdup(value); 51 repo->name = xstrdup(value);
50 else if (!strcmp(name, "clone-url")) 52 else if (!strcmp(name, "clone-url"))
51 repo->clone_url = xstrdup(value); 53 repo->clone_url = xstrdup(value);
52 else if (!strcmp(name, "desc")) 54 else if (!strcmp(name, "desc"))