From 808cc7ee2cbca2ce560770d6bc35ee70b3a4ae22 Mon Sep 17 00:00:00 2001 From: Stefan Richter Date: Sat, 5 Jun 2010 15:21:00 +0200 Subject: [PATCH] Always imply iso shutdown in fw_destroy_handle because ieee1394_destroy_handle does it too. Otherwise, clients which rely on the ieee1394 backend behaviour leak memory when running on the juju backend. Also add the ability to call fw_iso_shutdown multiple times or before a successful context initialization. Faulty clients might rely on it based on ieee1394 backend behaviour. Signed-off-by: Stefan Richter --- src/fw-iso.c | 3 +++ src/fw.c | 3 +-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/fw-iso.c b/src/fw-iso.c index 1829fd0..5193b9a 100644 --- a/src/fw-iso.c +++ b/src/fw-iso.c @@ -602,6 +602,9 @@ void fw_iso_stop(fw_handle_t handle) void fw_iso_shutdown(fw_handle_t handle) { + if (handle->iso.packets == NULL) + return; + munmap(handle->iso.buffer, handle->iso.buf_packets * handle->iso.max_packet_size); if (handle->iso.state != ISO_STOPPED) diff --git a/src/fw.c b/src/fw.c index f92c1b6..6c851e0 100644 --- a/src/fw.c +++ b/src/fw.c @@ -502,9 +502,8 @@ void fw_destroy_handle(fw_handle_t handle) close(handle->devices[i].fd); } - + fw_iso_shutdown(handle); close(handle->epoll_fd); - free(handle); return;