diff -Naurp libraw1394-1.3.0/juju/raw1394-iso.c libraw1394-1.3.0.fix/juju/raw1394-iso.c --- libraw1394-1.3.0/juju/raw1394-iso.c 2007-10-22 13:55:58.000000000 -0400 +++ libraw1394-1.3.0.fix/juju/raw1394-iso.c 2007-10-22 15:27:54.000000000 -0400 @@ -394,6 +394,7 @@ iso_init(raw1394handle_t handle, int typ handle->iso.fd = open(handle->local_filename, O_RDWR); if (handle->iso.fd < 0) { free(handle->iso.packets); + handle->iso.packets = NULL; return -1; } @@ -404,6 +405,7 @@ iso_init(raw1394handle_t handle, int typ handle->iso.fd, &ep) < 0) { close(handle->iso.fd); free(handle->iso.packets); + handle->iso.packets = NULL; return -1; } @@ -417,6 +419,8 @@ iso_init(raw1394handle_t handle, int typ if (retval < 0) { close(handle->iso.fd); free(handle->iso.packets); + handle->iso.packets = NULL; + printf("ioctl call failed, retval = %d\n", retval); return retval; } @@ -427,6 +431,7 @@ iso_init(raw1394handle_t handle, int typ if (handle->iso.buffer == MAP_FAILED) { close(handle->iso.fd); free(handle->iso.packets); + handle->iso.packets = NULL; return -1; } @@ -515,8 +520,12 @@ void raw1394_iso_stop(raw1394handle_t ha void raw1394_iso_shutdown(raw1394handle_t handle) { - munmap(handle->iso.buffer, - handle->iso.buf_packets * handle->iso.max_packet_size); + if (handle->iso.buffer) { + munmap(handle->iso.buffer, + handle->iso.buf_packets * handle->iso.max_packet_size); + handle->iso.buffer = NULL; + } close(handle->iso.fd); free(handle->iso.packets); + handle->iso.packets = NULL; }