device: copy the plink instance before realize_start_setup()

To make sure, we don't end up with a dangling pointer due
to an intermediate platform access which may invalidate the
pointer.
This commit is contained in:
Thomas Haller 2016-08-16 15:40:08 +02:00
parent 2cb18efaea
commit f04baa63c0

View file

@ -1955,6 +1955,8 @@ nm_device_realize_start (NMDevice *self,
gboolean *out_compatible,
GError **error)
{
NMPlatformLink plink_copy;
NM_SET_OUT (out_compatible, TRUE);
if (plink) {
@ -1969,6 +1971,10 @@ nm_device_realize_start (NMDevice *self,
return FALSE;
}
if (plink) {
plink_copy = *plink;
plink = &plink_copy;
}
realize_start_setup (self, plink);
return TRUE;