summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2015-02-08 10:04:06 +0100
committerThomas Haller <thaller@redhat.com>2015-02-09 11:51:05 +0100
commitb49fdae59eb443632503ed6dc589df27cd2de0c1 (patch)
treeed484ac68c7648a7681b23e1cb26f05e2e3d88a9
parent027ab3efaa4c3e0de12f921df6854373910b06e7 (diff)
downloadNetworkManager-b49fdae59eb443632503ed6dc589df27cd2de0c1.tar.gz
config: fix memleak in read_config()
-rw-r--r--src/nm-config.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/nm-config.c b/src/nm-config.c
index 03fca56b73..d28ed86fbb 100644
--- a/src/nm-config.c
+++ b/src/nm-config.c
@@ -471,8 +471,8 @@ read_config (GKeyFile *keyfile, const char *path, GError **error)
if (keys[k][len - 1] == '+') {
char *base_key = g_strndup (keys[k], len - 1);
- const char *old_val = g_key_file_get_value (keyfile, groups[g], base_key, NULL);
- const char *new_val = g_key_file_get_value (kf, groups[g], keys[k], NULL);
+ char *old_val = g_key_file_get_value (keyfile, groups[g], base_key, NULL);
+ char *new_val = g_key_file_get_value (kf, groups[g], keys[k], NULL);
if (old_val && *old_val) {
char *combined = g_strconcat (old_val, ",", new_val, NULL);
@@ -483,6 +483,8 @@ read_config (GKeyFile *keyfile, const char *path, GError **error)
g_key_file_set_value (keyfile, groups[g], base_key, new_val);
g_free (base_key);
+ g_free (old_val);
+ g_free (new_val);
continue;
}