summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2020-11-06 18:53:57 +0100
committerThomas Haller <thaller@redhat.com>2020-11-09 17:53:16 +0100
commit609b08e2eb6a10ca1ca87725207eafa5ac4f4b83 (patch)
tree0639129476d224f562748460ea39a978dd5ee91e
parent46e0a3374b39f40213b20a665c2313b2d08a947f (diff)
downloadNetworkManager-609b08e2eb6a10ca1ca87725207eafa5ac4f4b83.tar.gz
core/ovs: fix leak of "NMOvsdbPrivate.db_uuid
Also, never update the value to %NULL. If the current message does not contain a UUID, keep the previous one. Fixes: 830a5a14cb29 ('device: add support for OpenVSwitch devices')
-rw-r--r--src/devices/ovs/nm-ovsdb.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/devices/ovs/nm-ovsdb.c b/src/devices/ovs/nm-ovsdb.c
index 56b7421182..5a18c32734 100644
--- a/src/devices/ovs/nm-ovsdb.c
+++ b/src/devices/ovs/nm-ovsdb.c
@@ -1175,8 +1175,12 @@ ovsdb_got_update(NMOvsdb *self, json_t *msg)
}
if (ovs) {
- iter = json_object_iter(ovs);
- priv->db_uuid = iter ? g_strdup(json_object_iter_key(iter)) : NULL;
+ const char *s;
+
+ iter = json_object_iter(ovs);
+ s = json_object_iter_key(iter);
+ if (s)
+ nm_utils_strdup_reset(&priv->db_uuid, s);
}
/* Interfaces */