unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* [PATCH] notmuch-config: Fix memleaks.
@ 2009-11-21 22:17 Stefan Schmidt
  2009-11-21 23:23 ` Carl Worth
  0 siblings, 1 reply; 2+ messages in thread
From: Stefan Schmidt @ 2009-11-21 22:17 UTC (permalink / raw)
  To: notmuch

From 4bb598e6e0fa32d5184be54cb5c66fe364eba374 Mon Sep 17 00:00:00 2001
From: Holger Freyther <zecke@selfish.org>
Date: Sat, 21 Nov 2009 22:45:23 +0100
Subject: [PATCH] notmuch-config: Fix memleaks.

While talloc is great we need to free the g_error by hand.

Tested-by: Stefan Schmidt <stefan@datenfreihafen.org>
Signed-off-by: Holger Freyther <zecke@selfish.org>
---
 notmuch-config.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/notmuch-config.c b/notmuch-config.c
index 7252a19..aaa0372 100644
--- a/notmuch-config.c
+++ b/notmuch-config.c
@@ -207,9 +207,11 @@ notmuch_config_open (void *ctx,
 	    fprintf (stderr, "Error reading configuration file %s: %s\n",
 		     config->filename, error->message);
 	    talloc_free (config);
+	    g_error_free (error);
 	    return NULL;
 	}
 
+	g_error_free (error);
 	is_new = 1;
     }
 
@@ -308,6 +310,7 @@ notmuch_config_save (notmuch_config_t *config)
     if (! g_file_set_contents (config->filename, data, length, &error)) {
 	fprintf (stderr, "Error saving configuration to %s: %s\n",
 		 config->filename, error->message);
+	g_error_free (error);
 	return 1;
     }
 
-- 
1.6.5.3

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

* Re: [PATCH] notmuch-config: Fix memleaks.
  2009-11-21 22:17 [PATCH] notmuch-config: Fix memleaks Stefan Schmidt
@ 2009-11-21 23:23 ` Carl Worth
  0 siblings, 0 replies; 2+ messages in thread
From: Carl Worth @ 2009-11-21 23:23 UTC (permalink / raw)
  To: Stefan Schmidt, notmuch

On Sat, 21 Nov 2009 23:17:02 +0100, Stefan Schmidt <stefan@datenfreihafen.org> wrote:
> 
> While talloc is great we need to free the g_error by hand.
> 
> Tested-by: Stefan Schmidt <stefan@datenfreihafen.org>
> Signed-off-by: Holger Freyther <zecke@selfish.org>

Thanks to both of you! This is pushed.

As for talloc and glib, it's become clear to me that I'd really like a
talloc-friendly hash-table implementation, (and maybe a nice growing
array). I really haven't seen any other data structures in glib that I'd
need as universally as I need those, (particularly since talloc already
provides a bunch of string functions).

-Carl

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

end of thread, other threads:[~2009-11-21 23:23 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-11-21 22:17 [PATCH] notmuch-config: Fix memleaks Stefan Schmidt
2009-11-21 23:23 ` Carl Worth

Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

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 read-only IMAP folder(s) and NNTP newsgroup(s).