summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorluozhengzheng <[email protected]>2016-10-05 09:15:57 +0800
committerBrian Behlendorf <[email protected]>2016-10-04 18:15:57 -0700
commite2c292bbfc9f1133c3faa46ac88f794b64da7ce2 (patch)
treeb29fec24270e4ddbde174590bdcfe930ae84e00d /lib
parent5cc78dc81232bc474d25ccfcacb42d80d83c5310 (diff)
Fix coverity defects: CID 150953, 147603, 147610
coverity scan CID:150953,type: uninitialized scalar variable coverity scan CID:147603,type: Resource leak coverity scan CID:147610,type: Resource leak Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: luozhengzheng <[email protected]> Closes #5209
Diffstat (limited to 'lib')
-rwxr-xr-xlib/libzpool/kernel.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/libzpool/kernel.c b/lib/libzpool/kernel.c
index 60dda39a8..579626220 100755
--- a/lib/libzpool/kernel.c
+++ b/lib/libzpool/kernel.c
@@ -599,8 +599,8 @@ cv_broadcast(kcondvar_t *cv)
int
vn_open(char *path, int x1, int flags, int mode, vnode_t **vpp, int x2, int x3)
{
- int fd;
- int dump_fd;
+ int fd = -1;
+ int dump_fd = -1;
vnode_t *vp;
int old_umask = 0;
char *realpath;
@@ -698,6 +698,8 @@ vn_open(char *path, int x1, int flags, int mode, vnode_t **vpp, int x2, int x3)
if (fstat64_blk(fd, &st) == -1) {
err = errno;
close(fd);
+ if (dump_fd != -1)
+ close(dump_fd);
return (err);
}