mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-01-04 23:50:16 +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') (cherry picked from commit3e3b629586)
This commit is contained in:
parent
3e9b5217f3
commit
ef29015d0b
1 changed files with 3 additions and 1 deletions
|
|
@ -228,8 +228,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