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 <stefanr@s5r6.in-berlin.de>
This commit is contained in:
Stefan Richter 2010-06-05 15:21:00 +02:00
parent c18094afb2
commit 808cc7ee2c
2 changed files with 4 additions and 2 deletions

View File

@ -602,6 +602,9 @@ void fw_iso_stop(fw_handle_t handle)
void fw_iso_shutdown(fw_handle_t handle) void fw_iso_shutdown(fw_handle_t handle)
{ {
if (handle->iso.packets == NULL)
return;
munmap(handle->iso.buffer, munmap(handle->iso.buffer,
handle->iso.buf_packets * handle->iso.max_packet_size); handle->iso.buf_packets * handle->iso.max_packet_size);
if (handle->iso.state != ISO_STOPPED) if (handle->iso.state != ISO_STOPPED)

View File

@ -502,9 +502,8 @@ void fw_destroy_handle(fw_handle_t handle)
close(handle->devices[i].fd); close(handle->devices[i].fd);
} }
fw_iso_shutdown(handle);
close(handle->epoll_fd); close(handle->epoll_fd);
free(handle); free(handle);
return; return;