From 8085c633bce9fed1a74dd2037d7f3a95f839a4e2 Mon Sep 17 00:00:00 2001 From: Jarod Wilson Date: Wed, 24 Oct 2007 16:50:24 -0400 Subject: [PATCH] Set handle->iso.packets to NULL after freeing to avoid double-frees. --- juju/raw1394-iso.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/juju/raw1394-iso.c b/juju/raw1394-iso.c index b1e493c..ae8aaad 100644 --- a/juju/raw1394-iso.c +++ b/juju/raw1394-iso.c @@ -389,6 +389,7 @@ iso_init(raw1394handle_t handle, int type, handle->iso.fd = open(handle->local_filename, O_RDWR); if (handle->iso.fd < 0) { free(handle->iso.packets); + handle->iso.packets = NULL; return -1; } @@ -399,6 +400,7 @@ iso_init(raw1394handle_t handle, int type, handle->iso.fd, &ep) < 0) { close(handle->iso.fd); free(handle->iso.packets); + handle->iso.packets = NULL; return -1; } @@ -412,6 +414,7 @@ iso_init(raw1394handle_t handle, int type, if (retval < 0) { close(handle->iso.fd); free(handle->iso.packets); + handle->iso.packets = NULL; return retval; } @@ -422,6 +425,7 @@ iso_init(raw1394handle_t handle, int type, if (handle->iso.buffer == MAP_FAILED) { close(handle->iso.fd); free(handle->iso.packets); + handle->iso.packets = NULL; return -1; } @@ -514,4 +518,5 @@ void raw1394_iso_shutdown(raw1394handle_t handle) handle->iso.buf_packets * handle->iso.max_packet_size); close(handle->iso.fd); free(handle->iso.packets); + handle->iso.packets = NULL; }