forked from Imagelibrary/rtems
Fixed iop/memory leak bug reported by Dan Dickey.
This commit is contained in:
@@ -324,6 +324,7 @@ __rtems_close(
|
|||||||
rtems_driver_name_t *np;
|
rtems_driver_name_t *np;
|
||||||
rtems_libio_t *iop;
|
rtems_libio_t *iop;
|
||||||
rtems_libio_open_close_args_t args;
|
rtems_libio_open_close_args_t args;
|
||||||
|
int status;
|
||||||
|
|
||||||
if (rtems_file_descriptor_type(fd)) {
|
if (rtems_file_descriptor_type(fd)) {
|
||||||
int (*fp)(int fd);
|
int (*fp)(int fd);
|
||||||
@@ -333,7 +334,9 @@ __rtems_close(
|
|||||||
errno = EBADF;
|
errno = EBADF;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
return (*fp)(fd);
|
status = (*fp)(fd);
|
||||||
|
rtems_libio_free(iop);
|
||||||
|
return status;
|
||||||
}
|
}
|
||||||
iop = rtems_libio_iop(fd);
|
iop = rtems_libio_iop(fd);
|
||||||
rtems_libio_check_fd(fd);
|
rtems_libio_check_fd(fd);
|
||||||
@@ -346,6 +349,8 @@ __rtems_close(
|
|||||||
|
|
||||||
rc = rtems_io_close(np->major, np->minor, (void *) &args);
|
rc = rtems_io_close(np->major, np->minor, (void *) &args);
|
||||||
|
|
||||||
|
rtems_libio_free(iop);
|
||||||
|
|
||||||
if (rc != RTEMS_SUCCESSFUL)
|
if (rc != RTEMS_SUCCESSFUL)
|
||||||
return rtems_libio_errno(rc);
|
return rtems_libio_errno(rc);
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@@ -324,6 +324,7 @@ __rtems_close(
|
|||||||
rtems_driver_name_t *np;
|
rtems_driver_name_t *np;
|
||||||
rtems_libio_t *iop;
|
rtems_libio_t *iop;
|
||||||
rtems_libio_open_close_args_t args;
|
rtems_libio_open_close_args_t args;
|
||||||
|
int status;
|
||||||
|
|
||||||
if (rtems_file_descriptor_type(fd)) {
|
if (rtems_file_descriptor_type(fd)) {
|
||||||
int (*fp)(int fd);
|
int (*fp)(int fd);
|
||||||
@@ -333,7 +334,9 @@ __rtems_close(
|
|||||||
errno = EBADF;
|
errno = EBADF;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
return (*fp)(fd);
|
status = (*fp)(fd);
|
||||||
|
rtems_libio_free(iop);
|
||||||
|
return status;
|
||||||
}
|
}
|
||||||
iop = rtems_libio_iop(fd);
|
iop = rtems_libio_iop(fd);
|
||||||
rtems_libio_check_fd(fd);
|
rtems_libio_check_fd(fd);
|
||||||
@@ -346,6 +349,8 @@ __rtems_close(
|
|||||||
|
|
||||||
rc = rtems_io_close(np->major, np->minor, (void *) &args);
|
rc = rtems_io_close(np->major, np->minor, (void *) &args);
|
||||||
|
|
||||||
|
rtems_libio_free(iop);
|
||||||
|
|
||||||
if (rc != RTEMS_SUCCESSFUL)
|
if (rc != RTEMS_SUCCESSFUL)
|
||||||
return rtems_libio_errno(rc);
|
return rtems_libio_errno(rc);
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@@ -324,6 +324,7 @@ __rtems_close(
|
|||||||
rtems_driver_name_t *np;
|
rtems_driver_name_t *np;
|
||||||
rtems_libio_t *iop;
|
rtems_libio_t *iop;
|
||||||
rtems_libio_open_close_args_t args;
|
rtems_libio_open_close_args_t args;
|
||||||
|
int status;
|
||||||
|
|
||||||
if (rtems_file_descriptor_type(fd)) {
|
if (rtems_file_descriptor_type(fd)) {
|
||||||
int (*fp)(int fd);
|
int (*fp)(int fd);
|
||||||
@@ -333,7 +334,9 @@ __rtems_close(
|
|||||||
errno = EBADF;
|
errno = EBADF;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
return (*fp)(fd);
|
status = (*fp)(fd);
|
||||||
|
rtems_libio_free(iop);
|
||||||
|
return status;
|
||||||
}
|
}
|
||||||
iop = rtems_libio_iop(fd);
|
iop = rtems_libio_iop(fd);
|
||||||
rtems_libio_check_fd(fd);
|
rtems_libio_check_fd(fd);
|
||||||
@@ -346,6 +349,8 @@ __rtems_close(
|
|||||||
|
|
||||||
rc = rtems_io_close(np->major, np->minor, (void *) &args);
|
rc = rtems_io_close(np->major, np->minor, (void *) &args);
|
||||||
|
|
||||||
|
rtems_libio_free(iop);
|
||||||
|
|
||||||
if (rc != RTEMS_SUCCESSFUL)
|
if (rc != RTEMS_SUCCESSFUL)
|
||||||
return rtems_libio_errno(rc);
|
return rtems_libio_errno(rc);
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user