diff options
author | Thomas Haller <thaller@redhat.com> | 2015-02-07 16:27:49 +0100 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2015-02-09 11:51:06 +0100 |
commit | 98a0299265647a88cf9d4de6270a2c58456011f0 (patch) | |
tree | dcf3d09149cbb053f52c5bb0472ca3b3fcc95dcf | |
parent | 494c5c395da5a358f16f5960c9de7b08aac17d01 (diff) | |
download | NetworkManager-98a0299265647a88cf9d4de6270a2c58456011f0.tar.gz |
ifcfg-rh: fix memleak in svSetValue()
-rw-r--r-- | src/settings/plugins/ifcfg-rh/shvar.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/settings/plugins/ifcfg-rh/shvar.c b/src/settings/plugins/ifcfg-rh/shvar.c index 6c9769b2c8..5f3d173b2a 100644 --- a/src/settings/plugins/ifcfg-rh/shvar.c +++ b/src/settings/plugins/ifcfg-rh/shvar.c @@ -372,10 +372,12 @@ svSetValue (shvarFile *s, const char *key, const char *value, gboolean verbatim) if (oldval) { /* delete line */ s->lineList = g_list_remove_link (s->lineList, s->current); + g_free (s->current->data); g_list_free_1 (s->current); s->modified = TRUE; } - goto bail; /* do not need keyValue */ + g_free (keyValue); + goto end; } if (!oldval) { @@ -387,21 +389,19 @@ svSetValue (shvarFile *s, const char *key, const char *value, gboolean verbatim) if (strcmp (oldval, newval) != 0) { /* change line */ - if (s->current) + if (s->current) { + g_free (s->current->data); s->current->data = keyValue; - else + } else s->lineList = g_list_append (s->lineList, keyValue); s->modified = TRUE; - } + } else + g_free (keyValue); end: g_free (newval); g_free (oldval); return; - - bail: - g_free (keyValue); - goto end; } /* Write the current contents iff modified. Returns FALSE on error |