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: 830a5a14cb ('device: add support for OpenVSwitch devices')
(cherry picked from commit 609b08e2eb)
(cherry picked from commit 0464c36a02)
(cherry picked from commit e1424f264d)
This commit is contained in:
Thomas Haller 2020-11-06 18:53:57 +01:00
parent 4e3fa4f468
commit be7ad90218
No known key found for this signature in database
GPG key ID: 29C2366E4DFC5728

View file

@ -1020,8 +1020,12 @@ ovsdb_got_update (NMOvsdb *self, json_t *msg)
}
if (ovs) {
const char *s;
iter = json_object_iter (ovs);
priv->db_uuid = iter ? g_strdup (json_object_iter_key (iter)) : NULL;
s = json_object_iter_key (iter);
if (s)
nm_utils_strdup_reset (&priv->db_uuid, s);
}
/* Interfaces */