diff options
author | 2012-09-05 19:45:42 -0400 | |
---|---|---|
committer | 2012-09-05 19:45:42 -0400 | |
commit | 51b24876f8d7af6b4a292bc43266d2012dde3cae (patch) | |
tree | 944c6e5277282e8374d412990a75e25b52a2208c | |
parent | Merge *-utils, rename ShellUtilsTrivial to ShellParser, fix memory leaks (diff) | |
download | openrc-settingsd-51b24876f8d7af6b4a292bc43266d2012dde3cae.tar.gz openrc-settingsd-51b24876f8d7af6b4a292bc43266d2012dde3cae.tar.bz2 openrc-settingsd-51b24876f8d7af6b4a292bc43266d2012dde3cae.zip |
Fix memory leaks
-rw-r--r-- | src/localed.c | 9 | ||||
-rw-r--r-- | src/timedated.c | 1 |
2 files changed, 8 insertions, 2 deletions
diff --git a/src/localed.c b/src/localed.c index 0cb4404..5eb3f65 100644 --- a/src/localed.c +++ b/src/localed.c @@ -620,6 +620,7 @@ xorg_confd_parser_line_set_or_delete (GList *line, next->prev = prev; return prev; } + g_free (entry->value); entry->value = g_strdup (value); replacement = g_strdup_printf ("\\1\"%s\"", value); replaced = g_regex_replace (re, entry->string, -1, 0, replacement, 0, NULL); @@ -871,7 +872,10 @@ on_handle_set_locale_authorized_cb (GObject *source_object, out: shell_parser_free (locale_file_parsed); - g_strfreev (locale_values); + /* g_strfreev (locale_values) will leak, since it stops at first NULL value */ + for (val = locale_values, var = locale_variables; *var != NULL; val++, var++) + g_free (*val); + g_free (locale_values); invoked_locale_free (data); if (err != NULL) g_error_free (err); @@ -1281,11 +1285,12 @@ localed_init (gboolean _read_only) for (variable = locale_variables, value = locale_values; *variable != NULL; variable++, value++) { if (*value != NULL) { *loc = g_strdup_printf ("%s=%s", *variable, *value); + g_free (*value); loc++; } } - g_strfreev (locale_values); + g_free (locale_values); } if (err != NULL) { g_debug ("%s", err->message); diff --git a/src/timedated.c b/src/timedated.c index d6588f4..32e9171 100644 --- a/src/timedated.c +++ b/src/timedated.c @@ -63,6 +63,7 @@ get_local_rtc (GError **error) clock = shell_source_var (hwclock_file, "${clock}", error); if (!g_strcmp0 (clock, "local")) ret = TRUE; + g_free (clock); return ret; } |