about summary refs log tree commit diff stats
path: root/src/config
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2014-06-18 21:36:09 +0100
committerJames Booth <boothj5@gmail.com>2014-06-18 21:36:09 +0100
commitd668d15081f3d38d618457cb9016100acc6877dc (patch)
treef15f1535cd42bd6c101dc1bbfeb97902219f98eb /src/config
parent7344d3b8987f6e2edb12a3861a07006e27fb80e5 (diff)
downloadprofani-tty-d668d15081f3d38d618457cb9016100acc6877dc.tar.gz
Free aliases on cmd_init
Diffstat (limited to 'src/config')
-rw-r--r--src/config/preferences.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/config/preferences.c b/src/config/preferences.c
index 49203bfb..b187bc32 100644
--- a/src/config/preferences.c
+++ b/src/config/preferences.c
@@ -348,11 +348,15 @@ prefs_get_aliases(void)
             char *name = keys[i];
             char *value = g_key_file_get_string(prefs, PREF_GROUP_ALIAS, name, NULL);
 
-            ProfAlias *alias = malloc(sizeof(struct prof_alias_t));
-            alias->name = strdup(name);
-            alias->value = strdup(value);
+            if (value != NULL) {
+                ProfAlias *alias = malloc(sizeof(struct prof_alias_t));
+                alias->name = strdup(name);
+                alias->value = strdup(value);
 
-            result = g_list_insert_sorted(result, alias, (GCompareFunc)_alias_cmp);
+                free(value);
+
+                result = g_list_insert_sorted(result, alias, (GCompareFunc)_alias_cmp);
+            }
         }
 
         g_strfreev(keys);