summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authornigel <nigel>2006-11-08 00:22:43 +0000
committernigel <nigel>2006-11-08 00:22:43 +0000
commit29e4e30ee56360db4e0131e89df23baf70184afb (patch)
tree11e2f76bfab9b498d2d359fb4b21c523ad43b403 /src
parenta8ce2df9a4331183ec6c40a20f8da26e4ff5bc82 (diff)
downloadberyl-manager-29e4e30ee56360db4e0131e89df23baf70184afb.tar.gz
beryl-manager-29e4e30ee56360db4e0131e89df23baf70184afb.tar.bz2
beryl-manager: Fix some memory leaks found with valgrind.
Diffstat (limited to 'src')
-rw-r--r--src/main.c25
1 files changed, 19 insertions, 6 deletions
diff --git a/src/main.c b/src/main.c
index 5044e52..1ffcb84 100644
--- a/src/main.c
+++ b/src/main.c
@@ -261,6 +261,7 @@ void load_settings()
void save_settings()
{
gchar * path = g_strconcat(g_get_home_dir(),"/.beryl-managerrc",NULL);
+ gchar * data;
GKeyFile * f = g_key_file_new();
g_key_file_set_integer(f,"wm-settings","active_wm",WM);
g_key_file_set_integer(f,"wm-settings","fallback_wm",fallBackWM);
@@ -269,9 +270,11 @@ void save_settings()
if (!XGL && NV9XXX)
g_key_file_set_boolean(f,"beryl-settings","no_gl_yield",
noGLYield);
- g_file_set_contents(path,g_key_file_to_data(f,NULL,NULL),-1,NULL);
+ data = g_key_file_to_data(f,NULL,NULL);
+ g_file_set_contents(path,data,-1,NULL);
g_key_file_free(f);
g_free(path);
+ g_free(data);
}
gboolean is_running(const gchar * command)
{
@@ -297,14 +300,18 @@ gboolean is_running(const gchar * command)
{
if (strncmp(cp,"DISPLAY=",8)==0)
{
- if (strcmp(display_part(cp+8),displayname)==0)
+ gchar * part = display_part(cp+8);
+ if (strcmp(part,displayname)==0)
{
g_strfreev(pidlist);
g_free(pret);
g_free(file);
g_free(buffer);
+ g_free(cmd);
+ g_free(part);
return TRUE;
}
+ g_free(part);
}
}
}
@@ -317,6 +324,7 @@ gboolean is_running(const gchar * command)
}
g_free(pret);
}
+ g_free(cmd);
return FALSE;
}
gboolean is_decor_running()
@@ -734,10 +742,10 @@ gboolean is_wm_running(gint wm)
gboolean detect_app(const gchar * app)
{
gint ex;
- if (!g_spawn_command_line_sync(
- g_strdup_printf("sh -c 'which %s > /dev/null 2>&1'",app),
- NULL,NULL,&ex,NULL))
+ gchar *f = g_strdup_printf("sh -c 'which %s > /dev/null 2>&1'",app);
+ if (!g_spawn_command_line_sync(f,NULL,NULL,&ex,NULL))
manager_error(_("can't use this app, no which"));
+ g_free(f);
if (WIFEXITED(ex))
{
if (WEXITSTATUS(ex)==0)
@@ -1192,6 +1200,8 @@ int main(int argc, char ** argv)
gtk_main();
gdk_threads_leave ();
+ g_free(displayname);
+
return 0;
}
@@ -1219,9 +1229,12 @@ Window_With_Name (Display * dpy, Window top, char *name)
Window w = 0;
char *window_name;
- if (XFetchName (dpy, top, &window_name) && !strcmp (window_name, name))
+ if (XFetchName (dpy, top, &window_name) && !strcmp (window_name, name)) {
+ XFree(window_name);
return (top);
+ }
+ XFree(window_name);
if (!XQueryTree (dpy, top, &dummy, &dummy, &children, &nchildren))
return (0);