List for cgit developers and users
 help / color / mirror / Atom feed
* [PATCH v1 0/2] Fixes
@ 2011-03-09  7:16 mailings
  2011-03-09  7:16 ` [PATCH v1 1/2] source_filter: fix a memory leak mailings
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: mailings @ 2011-03-09  7:16 UTC (permalink / raw)


From: Ferry Huberts <ferry.huberts at pelagic.nl>

These patches fix a memory leak (patch 1) and an initialisation
bug (patch 2).

Patch 2 incorporates feedback from Lars.

This series is split out from my series on handing repo config
to filter scripts.

Ferry Huberts (2):
  source_filter: fix a memory leak
  new_filter: correctly initialise all arguments for a new filter

 cgit.c    |    6 ++++--
 ui-tree.c |    2 ++
 2 files changed, 6 insertions(+), 2 deletions(-)

-- 
1.7.4





^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH v1 1/2] source_filter: fix a memory leak
  2011-03-09  7:16 [PATCH v1 0/2] Fixes mailings
@ 2011-03-09  7:16 ` mailings
  2011-03-09  7:16 ` [PATCH v1 2/2] new_filter: correctly initialise all arguments for a new filter mailings
  2011-03-26 14:04 ` [PATCH v1 0/2] Fixes mailings
  2 siblings, 0 replies; 5+ messages in thread
From: mailings @ 2011-03-09  7:16 UTC (permalink / raw)


From: Ferry Huberts <ferry.huberts at pelagic.nl>

Signed-off-by: Ferry Huberts <ferry.huberts at pelagic.nl>
---
 ui-tree.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/ui-tree.c b/ui-tree.c
index 0b1b531..442b6be 100644
--- a/ui-tree.c
+++ b/ui-tree.c
@@ -48,6 +48,8 @@ static void print_text_buffer(const char *name, char *buf, unsigned long size)
 		cgit_open_filter(ctx.repo->source_filter);
 		html_raw(buf, size);
 		cgit_close_filter(ctx.repo->source_filter);
+		free(ctx.repo->source_filter->argv[1]);
+		ctx.repo->source_filter->argv[1] = NULL;
 		html("</code></pre></td></tr></table>\n");
 		return;
 	}
-- 
1.7.4





^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH v1 2/2] new_filter: correctly initialise all arguments for a new filter
  2011-03-09  7:16 [PATCH v1 0/2] Fixes mailings
  2011-03-09  7:16 ` [PATCH v1 1/2] source_filter: fix a memory leak mailings
@ 2011-03-09  7:16 ` mailings
  2011-03-26 14:04 ` [PATCH v1 0/2] Fixes mailings
  2 siblings, 0 replies; 5+ messages in thread
From: mailings @ 2011-03-09  7:16 UTC (permalink / raw)


From: Ferry Huberts <ferry.huberts at pelagic.nl>

Signed-off-by: Ferry Huberts <ferry.huberts at pelagic.nl>
---
 cgit.c |    6 ++++--
 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
@@ -29,15 +29,17 @@ void add_mimetype(const char *name, const char *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;
 }
 
-- 
1.7.4





^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH v1 0/2] Fixes
  2011-03-09  7:16 [PATCH v1 0/2] Fixes mailings
  2011-03-09  7:16 ` [PATCH v1 1/2] source_filter: fix a memory leak mailings
  2011-03-09  7:16 ` [PATCH v1 2/2] new_filter: correctly initialise all arguments for a new filter mailings
@ 2011-03-26 14:04 ` mailings
  2011-03-26 14:29   ` hjemli
  2 siblings, 1 reply; 5+ messages in thread
From: mailings @ 2011-03-26 14:04 UTC (permalink / raw)


On 03/09/2011 08:16 AM, Ferry Huberts wrote:
> From: Ferry Huberts <ferry.huberts at pelagic.nl>
> 
> These patches fix a memory leak (patch 1) and an initialisation
> bug (patch 2).
> 
> Patch 2 incorporates feedback from Lars.
> 
> This series is split out from my series on handing repo config
> to filter scripts.
> 
> Ferry Huberts (2):
>   source_filter: fix a memory leak
>   new_filter: correctly initialise all arguments for a new filter
> 
>  cgit.c    |    6 ++++--
>  ui-tree.c |    2 ++
>  2 files changed, 6 insertions(+), 2 deletions(-)
> 

Lars,

Maybe you're still working on it, maybe you forgot about these 2 patches...

You can get them also from github:
  https://github.com/fhuberts/cgit/tree/fixes


thanks

-- 
Ferry Huberts




^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH v1 0/2] Fixes
  2011-03-26 14:04 ` [PATCH v1 0/2] Fixes mailings
@ 2011-03-26 14:29   ` hjemli
  0 siblings, 0 replies; 5+ messages in thread
From: hjemli @ 2011-03-26 14:29 UTC (permalink / raw)


On Sat, Mar 26, 2011 at 15:04, Ferry Huberts <mailings at hupie.com> wrote:
> On 03/09/2011 08:16 AM, Ferry Huberts wrote:
>> From: Ferry Huberts <ferry.huberts at pelagic.nl>
>>
>> These patches fix a memory leak (patch 1) and an initialisation
>> bug (patch 2).
>>
>
> Maybe you're still working on it, maybe you forgot about these 2 patches...

I forgot, thanks for the reminder. They're now applied to my stable branch.

--
larsh




^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2011-03-26 14:29 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-03-09  7:16 [PATCH v1 0/2] Fixes mailings
2011-03-09  7:16 ` [PATCH v1 1/2] source_filter: fix a memory leak mailings
2011-03-09  7:16 ` [PATCH v1 2/2] new_filter: correctly initialise all arguments for a new filter mailings
2011-03-26 14:04 ` [PATCH v1 0/2] Fixes mailings
2011-03-26 14:29   ` hjemli

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).