mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 21:55:25 +00:00
lxc: eliminate extraneous free of netDef->ifname_guest
lxcContainerRenameAndEnableInterfaces() isn't making a copy of the interface's ifname_guest (into newname), it's just copying the pointer to it. This means that when it later calls VIR_FREE(newname), it's actually freeing up (and fortunately NULLing out, so at least we don't try to access free'd memory) netDef->ifname_guest.
This commit is contained in:
parent
9359167ec0
commit
f03a4a2a96
@ -490,7 +490,7 @@ static int lxcContainerRenameAndEnableInterfaces(virDomainDefPtr vmDef,
|
|||||||
{
|
{
|
||||||
int rc = 0;
|
int rc = 0;
|
||||||
size_t i, j;
|
size_t i, j;
|
||||||
char *newname = NULL;
|
const char *newname;
|
||||||
char *toStr = NULL;
|
char *toStr = NULL;
|
||||||
char *viaStr = NULL;
|
char *viaStr = NULL;
|
||||||
virDomainNetDefPtr netDef;
|
virDomainNetDefPtr netDef;
|
||||||
@ -552,8 +552,6 @@ static int lxcContainerRenameAndEnableInterfaces(virDomainDefPtr vmDef,
|
|||||||
VIR_FREE(viaStr);
|
VIR_FREE(viaStr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
VIR_FREE(newname);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* enable lo device only if there were other net devices */
|
/* enable lo device only if there were other net devices */
|
||||||
@ -563,7 +561,6 @@ static int lxcContainerRenameAndEnableInterfaces(virDomainDefPtr vmDef,
|
|||||||
error_out:
|
error_out:
|
||||||
VIR_FREE(toStr);
|
VIR_FREE(toStr);
|
||||||
VIR_FREE(viaStr);
|
VIR_FREE(viaStr);
|
||||||
VIR_FREE(newname);
|
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user