mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-22 02:27:36 +03:00
Fix coverity defects
Fix coverity defects: coverity scan CID:147623, Type: Resource leak. coverity scan CID:147622, Type: Resource leak. reason: zpool_open zhp, but not zpool_close zhp. so resource leak. coverity scan CID:147621, Type: Resource fd leak. coverity scan CID:147620, Type: Resource fd leak. reason: do_write do_read open file fd,but exception not close fd. delete unuse definition DMU_OS_IS_L2COMPRESSIBLE. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: cao.xuewen <cao.xuewen@zte.com.cn> Closes #5137
This commit is contained in:
@@ -110,6 +110,7 @@ do_read(const char *pfile)
|
||||
if (read(fd, buf, sizeof (buf)) == -1) {
|
||||
(void) fprintf(stderr, "read(%d, buf, %zd) failed with errno "
|
||||
"%d\n", fd, sizeof (buf), errno);
|
||||
(void) close(fd);
|
||||
return (1);
|
||||
}
|
||||
(void) close(fd);
|
||||
@@ -133,6 +134,7 @@ do_write(const char *pfile)
|
||||
if (write(fd, buf, strlen(buf)) == -1) {
|
||||
(void) fprintf(stderr, "write(%d, buf, %d) failed with errno "
|
||||
"%d\n", fd, (int)strlen(buf), errno);
|
||||
(void) close(fd);
|
||||
return (1);
|
||||
}
|
||||
(void) close(fd);
|
||||
|
||||
Reference in New Issue
Block a user