Correctly free nd structureqemu-0.10.92-5.fc12
commit2b76390876db26fb279d26de86b2c0b8260ff142
authorGlauber Costa <glommer@redhat.com>
Wed, 23 Sep 2009 08:49:43 +0000 (23 09:49 +0100)
committerMark McLoughlin <markmc@redhat.com>
Wed, 23 Sep 2009 11:19:51 +0000 (23 12:19 +0100)
tree9a0573884bdb160f861f7e7c26eb02e8533d0a26
parent70415c7d31bf6420d1a2d685fe14661ce1cfd9cb
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