Correctly free nd structureqemu-0.11.0-1.fc12
commit3675a0dde74f890404f392e194f1adc6b24285f7
authorGlauber Costa <glommer@redhat.com>
Wed, 23 Sep 2009 08:49:43 +0000 (23 09:49 +0100)
committerMark McLoughlin <markmc@redhat.com>
Mon, 28 Sep 2009 07:22:29 +0000 (28 08:22 +0100)
treef599418879c36fde025678b62d042b8b742bdb44
parentc6c94b043e8b3593d0beb52966dce43069233840
Correctly free nd structure

When we "free" a NICInfo structure, we can leak pointers, since we don't do
much more than setting used = 0.

We free() the model parameter, but we don't set it to NULL. This means that
a new user of this structure will see garbage in there. It was not noticed
before because reusing a NICInfo is not that common, but it can be, for
users of device pci hotplug.

A user hit it, described at https://bugzilla.redhat.com/524022

This patch memset's the whole structure, guaranteeing that anyone reusing it
will see a fresh NICinfo. Also, we free some other strings that are currently
leaking.

This codebase is quite old, so this patch should feed all stable trees.

Signed-off-by: Glauber Costa <glommer@redhat.com>
Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Fedora-patch: qemu-correctly-free-nic-info-structure.patch
net.c
net.h
vl.c