[libvirt] [PATCH] qemu: Remove unnecessary variable assignment

Remove unnecessary 'addrs = NULL' in qemuDomainAssignS390Addresses() and qemuDomainAssignPCIAddresses() due to the related Free function in label cleanup. --- src/qemu/qemu_command.c | 2 -- 1 files changed, 0 insertions(+), 2 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 643532f..3cc9c1d 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -1320,7 +1320,6 @@ qemuDomainAssignS390Addresses(virDomainDefPtr def, qemuDomainCCWAddressSetFree(priv->ccwaddrs); priv->persistentAddrs = 1; priv->ccwaddrs = addrs; - addrs = NULL; } else { priv->persistentAddrs = 0; } @@ -1901,7 +1900,6 @@ qemuDomainAssignPCIAddresses(virDomainDefPtr def, qemuDomainPCIAddressSetFree(priv->pciaddrs); priv->persistentAddrs = 1; priv->pciaddrs = addrs; - addrs = NULL; } else { priv->persistentAddrs = 0; } -- 1.7.1

On 09/06/2013 07:35 AM, Hongwei Bi wrote:
Remove unnecessary 'addrs = NULL' in qemuDomainAssignS390Addresses() and qemuDomainAssignPCIAddresses() due to the related Free function in label cleanup.
But it is necessary, because we assign the value of addrs to priv->ccwaddrs. If we didn't set addrs to NULL, it would get freed by that function in the cleanup: section and priv->ccwaddrs would point to freed memory. Jan

I understand. Thanks for your reminding. 2013/9/6 Ján Tomko <jtomko@redhat.com>
On 09/06/2013 07:35 AM, Hongwei Bi wrote:
Remove unnecessary 'addrs = NULL' in qemuDomainAssignS390Addresses() and qemuDomainAssignPCIAddresses() due to the related Free function in label cleanup.
But it is necessary, because we assign the value of addrs to priv->ccwaddrs. If we didn't set addrs to NULL, it would get freed by that function in the cleanup: section and priv->ccwaddrs would point to freed memory.
Jan
participants (3)
-
Hongwei Bi
-
hw bi
-
Ján Tomko