mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-02-14 16:50:33 +01:00
libnm: fix leak with self assignment in nm_connection_add_setting()
We must consume the reference, like we would in the other case.
Interestingly, I am unable to reproduce a case where valgrind would
complain about the leak. But it is there nonetheless.
Fixes: 0a22f4e490 ('libnm: refactor tracking of NMSetting in NMConnection')
This commit is contained in:
parent
3b2eb689f3
commit
3e3b629586
1 changed files with 3 additions and 1 deletions
|
|
@ -202,8 +202,10 @@ _nm_connection_add_setting(NMConnection *connection, NMSetting *setting)
|
|||
priv = NM_CONNECTION_GET_PRIVATE(connection);
|
||||
|
||||
s_old = priv->settings[setting_info->meta_type];
|
||||
if (s_old == setting)
|
||||
if (s_old == setting) {
|
||||
g_object_unref(s_old);
|
||||
return;
|
||||
}
|
||||
|
||||
priv->settings[setting_info->meta_type] = setting;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue