summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2023-01-05 11:57:41 +0100
committerThomas Haller <thaller@redhat.com>2023-01-05 12:13:39 +0100
commitda371f81083293f774add7fe78a1153cc78b1675 (patch)
tree88f2d3eecf54cea64b6031871a00d24c8df1f1b5
parent6c81f281eb324706615f649d4dd23e531ca58ee5 (diff)
ndisc/tests: fix reference counting in nm_fake_ndisc_new()
This adjusts the change from commit ffbcf0158970 ('test-ndisc-fake: free l3cfg after creating fake-ndisc'). ndisc_new() already correctly handles the reference count of l3cfg via "gs_unref_object". The party that took the wrong reference was nm_fake_ndisc_new(). Fixes: 58287cbcc0c8 ('core: rework IP configuration in NetworkManager using layer 3 configuration')
-rw-r--r--src/core/ndisc/nm-fake-ndisc.c2
-rw-r--r--src/core/ndisc/tests/test-ndisc-fake.c1
2 files changed, 1 insertions, 2 deletions
diff --git a/src/core/ndisc/nm-fake-ndisc.c b/src/core/ndisc/nm-fake-ndisc.c
index 5811e480b6..f305e7713f 100644
--- a/src/core/ndisc/nm-fake-ndisc.c
+++ b/src/core/ndisc/nm-fake-ndisc.c
@@ -358,7 +358,7 @@ NMNDisc *
nm_fake_ndisc_new(NML3Cfg *l3cfg)
{
const NMNDiscConfig config = {
- .l3cfg = g_object_ref(NM_L3CFG(l3cfg)),
+ .l3cfg = NM_L3CFG(l3cfg),
.ifname = nm_l3cfg_get_ifname(l3cfg, TRUE),
.node_type = NM_NDISC_NODE_TYPE_HOST,
.stable_type = NM_UTILS_STABLE_TYPE_UUID,
diff --git a/src/core/ndisc/tests/test-ndisc-fake.c b/src/core/ndisc/tests/test-ndisc-fake.c
index d2704a080c..457dcf1982 100644
--- a/src/core/ndisc/tests/test-ndisc-fake.c
+++ b/src/core/ndisc/tests/test-ndisc-fake.c
@@ -33,7 +33,6 @@ ndisc_new(void)
memset(&iid, 0, sizeof(iid));
iid.id_u8[7] = 1;
nm_ndisc_set_iid(ndisc, iid, FALSE);
- g_object_unref(l3cfg);
return NM_FAKE_NDISC(ndisc);
}