forked from Imagelibrary/rtems
libblock/src/bdpart-register.c: Do not pass bad value to close()
Coverity CID 1467408 close() was called and fd can potentially be negative. Closes #5113.
This commit is contained in:
committed by
Chris Johns
parent
447f767abc
commit
5e6d7dca8f
@@ -208,8 +208,14 @@ rtems_status_code rtems_bdpart_unregister(
|
||||
|
||||
cleanup:
|
||||
|
||||
/*
|
||||
* When we get here, logical_disk_name is guaranteed to be non-NULL
|
||||
* but fd may be -1. Coverity flagged passing a bad value to close().
|
||||
*/
|
||||
free( logical_disk_name);
|
||||
close( fd);
|
||||
if (fd > 0) {
|
||||
close( fd);
|
||||
}
|
||||
|
||||
return esc;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user