[CGit] [PATCH 2/6] new_filter: correctly initialise all arguments for a new filter

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Ferry Huberts <ferry.huberts@xxxxxxxxxx>

Signed-off-by: Ferry Huberts <ferry.huberts@xxxxxxxxxx>
---
 cgit.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/cgit.c b/cgit.c
index 412fbf0..4440feb 100644
--- a/cgit.c
+++ b/cgit.c
@@ -28,6 +28,7 @@ void add_mimetype(const char *name, const char *value)
 
 struct cgit_filter *new_filter(const char *cmd, int extra_args)
 {
+	int i = 0;
 	struct cgit_filter *f;
 
 	if (!cmd || !cmd[0])
@@ -36,8 +37,10 @@ struct cgit_filter *new_filter(const char *cmd, int extra_args)
 	f = xmalloc(sizeof(struct cgit_filter));
 	f->cmd = xstrdup(cmd);
 	f->argv = xmalloc((2 + extra_args) * sizeof(char *));
-	f->argv[0] = f->cmd;
-	f->argv[1] = NULL;
+	f->argv[i++] = f->cmd;
+	while (i < (2 + extra_args)) {
+	  f->argv[i++] = NULL;
+	}
 	return f;
 }
 
-- 
1.7.4

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]