From 68daab633e81d270c4ec28dd55d941cb73c1ec6e Mon Sep 17 00:00:00 2001 From: Beniamino Galvani Date: Sun, 10 Feb 2019 13:32:28 +0100 Subject: [PATCH] ovs: fix leak of json objects Fixes: 830a5a14cb29ca00b73a9623c1ea7c5cd92f4d00 (cherry picked from commit 139b9974fa34ee01b9ff57b45e64faaf645db5e8) (cherry picked from commit 35c101011d0c67ed85996de77980e8e5f45c9cf4) --- src/devices/ovs/nm-ovsdb.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/devices/ovs/nm-ovsdb.c b/src/devices/ovs/nm-ovsdb.c index a9cb57034a..97b38cb15f 100644 --- a/src/devices/ovs/nm-ovsdb.c +++ b/src/devices/ovs/nm-ovsdb.c @@ -349,14 +349,14 @@ _insert_interface (json_t *params, NMConnection *interface) if (s_ovs_iface) type = nm_setting_ovs_interface_get_interface_type (s_ovs_iface); - json_array_append (options, json_string ("map")); + json_array_append_new (options, json_string ("map")); s_ovs_patch = nm_connection_get_setting_ovs_patch (interface); if (s_ovs_patch) { - json_array_append (options, json_pack ("[[s, s]]", + json_array_append_new (options, json_pack ("[[s, s]]", "peer", nm_setting_ovs_patch_get_peer (s_ovs_patch))); } else { - json_array_append (options, json_array ()); + json_array_append_new (options, json_array ()); } json_array_append_new (params, @@ -690,6 +690,9 @@ _delete_interface (NMOvsdb *self, json_t *params, const char *ifname) _expect_ovs_bridges (params, priv->db_uuid, bridges); _set_ovs_bridges (params, priv->db_uuid, new_bridges); } + + json_decref (bridges); + json_decref (new_bridges); } /**