From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ferry Huberts Subject: [CGit] [PATCH 2/6] new_filter: correctly initialise all arguments for a new filter Date: Thu, 17 Feb 2011 22:11:05 +0100 Message-ID: <1297977069-21884-3-git-send-email-mailings@hupie.com> References: <1297977069-21884-1-git-send-email-mailings@hupie.com> Cc: hjemli@gmail.com To: git@vger.kernel.org X-From: git-owner@vger.kernel.org Thu Feb 17 22:11:34 2011 Return-path: Envelope-to: gcvg-git-2@lo.gmane.org Received: from vger.kernel.org ([209.132.180.67]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1PqB8P-0007Wi-A9 for gcvg-git-2@lo.gmane.org; Thu, 17 Feb 2011 22:11:33 +0100 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758031Ab1BQVLN (ORCPT ); Thu, 17 Feb 2011 16:11:13 -0500 Received: from 82-197-206-98.dsl.cambrium.nl ([82.197.206.98]:57497 "EHLO mail.internal.Hupie.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1755851Ab1BQVLL (ORCPT ); Thu, 17 Feb 2011 16:11:11 -0500 Received: from paul.internal.hupie.com (paul.internal.Hupie.com [192.168.180.1]) by mail.internal.Hupie.com (Postfix) with ESMTP id 89C2358C999; Thu, 17 Feb 2011 22:11:09 +0100 (CET) X-Mailer: git-send-email 1.7.4 In-Reply-To: <1297977069-21884-1-git-send-email-mailings@hupie.com> Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Archived-At: From: Ferry Huberts Signed-off-by: Ferry Huberts --- 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