Commit 45956287 authored by Paolo Borelli's avatar Paolo Borelli Committed by Paolo Borelli

plug a small leak when saving state file.

2007-07-19  Paolo Borelli  <pborelli@katamail.com>

	* gedit/gedit-prefs-manager-app.c: plug a small leak when
	saving state file.


svn path=/trunk/; revision=5726
parent 011470de
2007-07-19 Paolo Borelli <pborelli@katamail.com>
* gedit/gedit-prefs-manager-app.c: plug a small leak when
saving state file.
2007-07-18 Paolo Borelli <pborelli@katamail.com>
* plugins/externaltools/tools/manager.py: fix typo that
......
......@@ -265,43 +265,55 @@ static gboolean
gedit_state_file_sync ()
{
GKeyFile *state_file;
const gchar *home;
gchar *path;
gchar *content;
gsize length;
GError *err = NULL;
gboolean ret = FALSE;
state_file = get_gedit_state_file ();
if (state_file != NULL)
g_return_val_if_fail (state_file != NULL, FALSE);
home = g_get_home_dir ();
if (home == NULL)
{
const gchar *home;
gchar *path;
gchar *content;
gsize length;
GError *err = NULL;
g_warning ("Could not get HOME directory\n");
return ret;
}
home = g_get_home_dir ();
if (home == NULL)
{
g_warning ("Could not get HOME directory\n");
return FALSE;
}
path = g_build_filename (home,
GEDIT_STATE_FILE_LOCATION,
NULL);
path = g_build_filename (home,
GEDIT_STATE_FILE_LOCATION,
NULL);
content = g_key_file_to_data (state_file,
&length,
&err);
content = g_key_file_to_data (state_file,
&length,
NULL);
if (err != NULL)
{
g_warning ("Could not get data from state file: %s\n",
err->message);
goto out;
}
if ((content != NULL) &&
(!g_file_set_contents (path,
content,
length,
&err)))
{
g_warning ("Could not write gedit state file: %s\n",
err->message);
return FALSE;
}
if ((content != NULL) &&
(!g_file_set_contents (path,
content,
length,
&err)))
{
g_warning ("Could not write gedit state file: %s\n",
err->message);
goto out;
}
ret = TRUE;
out:
g_free (content);
g_free (path);
return TRUE;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment