diff options
author | aliguori <aliguori@c046a42c-6fe2-441c-8c8c-71466251a162> | 2009-04-17 17:11:08 +0000 |
---|---|---|
committer | aliguori <aliguori@c046a42c-6fe2-441c-8c8c-71466251a162> | 2009-04-17 17:11:08 +0000 |
commit | b946a1533209f61a93e34898aebb5b43154b99c3 (patch) | |
tree | 36b0017910ca42cc5a41671b8edc7faa5da0a452 /tap-win32.c | |
parent | 32a8f6ae93f175518f86f99249177c35d1a85114 (diff) |
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
Diffstat (limited to 'tap-win32.c')
-rw-r--r-- | tap-win32.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/tap-win32.c b/tap-win32.c index e8a04dc7c0..3ff957fe69 100644 --- a/tap-win32.c +++ b/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); |