mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-04 00:03:54 -06:00
Introduce VLANClientState::cleanup() (Mark McLoughlin)
We're currently leaking memory and file descriptors on device hot-unplug. Signed-off-by: Mark McLoughlin <markmc@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@7150 c046a42c-6fe2-441c-8c8c-71466251a162
This commit is contained in:
parent
32a8f6ae93
commit
b946a15332
19 changed files with 347 additions and 66 deletions
15
tap-win32.c
15
tap-win32.c
|
@ -638,6 +638,18 @@ static int tap_win32_open(tap_win32_overlapped_t **phandle,
|
|||
tap_win32_overlapped_t *handle;
|
||||
} TAPState;
|
||||
|
||||
static void tap_cleanup(VLANClientState *vc)
|
||||
{
|
||||
TAPState *s = vc->opaque;
|
||||
|
||||
qemu_del_wait_object(s->handle->tap_semaphore, NULL, NULL);
|
||||
|
||||
/* FIXME: need to kill thread and close file handle:
|
||||
tap_win32_close(s);
|
||||
*/
|
||||
qemu_free(s);
|
||||
}
|
||||
|
||||
static void tap_receive(void *opaque, const uint8_t *buf, int size)
|
||||
{
|
||||
TAPState *s = opaque;
|
||||
|
@ -672,7 +684,8 @@ int tap_win32_init(VLANState *vlan, const char *model,
|
|||
return -1;
|
||||
}
|
||||
|
||||
s->vc = qemu_new_vlan_client(vlan, model, name, tap_receive, NULL, s);
|
||||
s->vc = qemu_new_vlan_client(vlan, model, name, tap_receive,
|
||||
NULL, tap_cleanup, s);
|
||||
|
||||
snprintf(s->vc->info_str, sizeof(s->vc->info_str),
|
||||
"tap: ifname=%s", ifname);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue