summaryrefslogtreecommitdiff
path: root/gui
diff options
context:
space:
mode:
authorBrian Cameron <brian.cameron@sun.com>2006-02-24 23:50:22 +0000
committerBrian Cameron <bcameron@src.gnome.org>2006-02-24 23:50:22 +0000
commitc549cca34eef11887c85ae7b4fac139996499330 (patch)
tree75c6e8e96be92853eaeeb451f6a3b899f55b8275 /gui
parent3f86de5d2f4d7f224ef7d2ed023a1e2a96e1dbac (diff)
downloadgdm-c549cca34eef11887c85ae7b4fac139996499330.tar.gz
Clean up memory handling.
2006-02-24 Brian Cameron <brian.cameron@sun.com> * gui/gdmconfig.c, gui/gdmsetup.c: Clean up memory handling.
Diffstat (limited to 'gui')
-rw-r--r--gui/gdmconfig.c31
-rw-r--r--gui/gdmsetup.c26
2 files changed, 32 insertions, 25 deletions
diff --git a/gui/gdmconfig.c b/gui/gdmconfig.c
index 10bf8acf..3071e801 100644
--- a/gui/gdmconfig.c
+++ b/gui/gdmconfig.c
@@ -109,6 +109,7 @@ gdm_config_add_hash (GHashTable *hash, gchar *key, gpointer value)
if (p != NULL)
*p = '\0';
+ /* Do not free the newkey since it is going into the hash. */
g_hash_table_insert (hash, newkey, value);
}
@@ -392,32 +393,36 @@ static gchar *
_gdm_config_get_translated_string (gchar *key, gboolean reload, gboolean *changed)
{
const GList *li;
- char *dkey;
+ char *newkey;
char *def;
/* Strip key */
- dkey = g_strdup (key);
- def = strchr (dkey, '=');
- if (def != NULL) {
- *def = '\0';
- def++;
- }
+ newkey = g_strdup (key);
+ def = strchr (newkey, '=');
+ if (def != NULL)
+ *def = '\0';
- for (li = ve_i18n_get_language_list ("LC_MESSAGES");
- li != NULL;
- li = li->next) {
- gchar *full = g_strdup_printf ("%s[%s]", dkey, (char *)li->data);
+ for (li = ve_i18n_get_language_list ("LC_MESSAGES");
+ li != NULL;
+ li = li->next) {
+ gchar *full = g_strdup_printf ("%s[%s]", newkey, (char *)li->data);
/*
* Pass TRUE for last argument so it doesn't print errors for
* failing to find the key, since this is expected
*/
- gchar *val = _gdm_config_get_string (full, reload, changed, TRUE);
+ gchar *val = _gdm_config_get_string (full, reload, changed, TRUE);
+
+ g_free (full);
- if (val != NULL)
+ if (val != NULL) {
+ g_free (newkey);
return val;
+ }
}
+ g_free (newkey);
+
/* Print error if it fails this time */
return _gdm_config_get_string (key, reload, changed, FALSE);
}
diff --git a/gui/gdmsetup.c b/gui/gdmsetup.c
index 80cc8690..7a996164 100644
--- a/gui/gdmsetup.c
+++ b/gui/gdmsetup.c
@@ -49,16 +49,16 @@
#include "gdmuser.h"
#include "gdmconfig.h"
-static char *GdmSoundProgram = NULL;
-gchar *GdmExclude = NULL;
-gchar *GdmInclude = NULL;
-gint GdmMinimalUID = 100;
-gint GdmIconMaxHeight;
-gint GdmIconMaxWidth;
-gboolean GdmIncludeAll;
-gboolean GdmAllowRoot;
-gboolean GdmAllowRemoteRoot;
-gboolean GdmUserChangesUnsaved;
+static char *GdmSoundProgram = NULL;
+static gchar *GdmExclude = NULL;
+static gchar *GdmInclude = NULL;
+static gint GdmMinimalUID = 100;
+static gint GdmIconMaxHeight;
+static gint GdmIconMaxWidth;
+static gboolean GdmIncludeAll;
+static gboolean GdmAllowRoot;
+static gboolean GdmAllowRemoteRoot;
+static gboolean GdmUserChangesUnsaved;
/* set the DOING_GDM_DEVELOPMENT env variable if you want to
* search for the glade file in the current dir and not the system
@@ -1718,9 +1718,11 @@ setup_include_exclude (GtkWidget *treeview, const char *key)
gtk_tree_view_set_model (GTK_TREE_VIEW(treeview),
(GTK_TREE_MODEL (face_store)));
- if (strcmp (ve_sure_string (key), GDM_KEY_INCLUDE) == 0)
+ if ((! ve_string_empty (GdmInclude)) &&
+ (strcmp (ve_sure_string (key), GDM_KEY_INCLUDE) == 0))
list = g_strsplit (GdmInclude, ",", 0);
- else if (strcmp (ve_sure_string (key), GDM_KEY_EXCLUDE) == 0)
+ else if ((! ve_string_empty (GdmExclude)) &&
+ (strcmp (ve_sure_string (key), GDM_KEY_EXCLUDE) == 0))
list = g_strsplit (GdmExclude, ",", 0);
else
list = NULL;