Set handle->iso.packets to NULL after freeing to avoid double-frees.
This commit is contained in:
parent
78a77758c7
commit
8085c633bc
|
@ -389,6 +389,7 @@ iso_init(raw1394handle_t handle, int type,
|
||||||
handle->iso.fd = open(handle->local_filename, O_RDWR);
|
handle->iso.fd = open(handle->local_filename, O_RDWR);
|
||||||
if (handle->iso.fd < 0) {
|
if (handle->iso.fd < 0) {
|
||||||
free(handle->iso.packets);
|
free(handle->iso.packets);
|
||||||
|
handle->iso.packets = NULL;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -399,6 +400,7 @@ iso_init(raw1394handle_t handle, int type,
|
||||||
handle->iso.fd, &ep) < 0) {
|
handle->iso.fd, &ep) < 0) {
|
||||||
close(handle->iso.fd);
|
close(handle->iso.fd);
|
||||||
free(handle->iso.packets);
|
free(handle->iso.packets);
|
||||||
|
handle->iso.packets = NULL;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -412,6 +414,7 @@ iso_init(raw1394handle_t handle, int type,
|
||||||
if (retval < 0) {
|
if (retval < 0) {
|
||||||
close(handle->iso.fd);
|
close(handle->iso.fd);
|
||||||
free(handle->iso.packets);
|
free(handle->iso.packets);
|
||||||
|
handle->iso.packets = NULL;
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -422,6 +425,7 @@ iso_init(raw1394handle_t handle, int type,
|
||||||
if (handle->iso.buffer == MAP_FAILED) {
|
if (handle->iso.buffer == MAP_FAILED) {
|
||||||
close(handle->iso.fd);
|
close(handle->iso.fd);
|
||||||
free(handle->iso.packets);
|
free(handle->iso.packets);
|
||||||
|
handle->iso.packets = NULL;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -514,4 +518,5 @@ void raw1394_iso_shutdown(raw1394handle_t handle)
|
||||||
handle->iso.buf_packets * handle->iso.max_packet_size);
|
handle->iso.buf_packets * handle->iso.max_packet_size);
|
||||||
close(handle->iso.fd);
|
close(handle->iso.fd);
|
||||||
free(handle->iso.packets);
|
free(handle->iso.packets);
|
||||||
|
handle->iso.packets = NULL;
|
||||||
}
|
}
|
||||||
|
|
Reference in New Issue