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>
This commit is contained in:
Holger Freyther 2009-11-21 22:45:23 +01:00 committed by Carl Worth
parent b5d7632000
commit 6c7ec294bb

View file

@ -207,9 +207,11 @@ notmuch_config_open (void *ctx,
fprintf (stderr, "Error reading configuration file %s: %s\n", fprintf (stderr, "Error reading configuration file %s: %s\n",
config->filename, error->message); config->filename, error->message);
talloc_free (config); talloc_free (config);
g_error_free (error);
return NULL; return NULL;
} }
g_error_free (error);
is_new = 1; is_new = 1;
} }
@ -308,6 +310,7 @@ notmuch_config_save (notmuch_config_t *config)
if (! g_file_set_contents (config->filename, data, length, &error)) { if (! g_file_set_contents (config->filename, data, length, &error)) {
fprintf (stderr, "Error saving configuration to %s: %s\n", fprintf (stderr, "Error saving configuration to %s: %s\n",
config->filename, error->message); config->filename, error->message);
g_error_free (error);
return 1; return 1;
} }