diff options
author | Allan Jude <[email protected]> | 2020-09-18 13:23:29 -0400 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2020-09-18 12:38:40 -0700 |
commit | 56e69c1e9ceeb20d40b8a443d7c0469267a23733 (patch) | |
tree | d1b81519ae1cac50335532d1e6d047a9387a338e /lib/libzfs/libzfs_util.c | |
parent | dacb4f6a61913886356e1e38cb9b2a92f6fc3aef (diff) |
libzfs: Don't leak buf if nvlist is too large
Resolves FreeBSD Coverity defect:
CID 1432398: Resource leaks (RESOURCE_LEAK)
libzfs: don't leak hdl if there is an error reading env var
Resolves FreeBSD Coverity defect:
CID 1432395: Resource leaks (RESOURCE_LEAK)
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Allan Jude <[email protected]>
Closes #10882
Diffstat (limited to 'lib/libzfs/libzfs_util.c')
-rw-r--r-- | lib/libzfs/libzfs_util.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/libzfs/libzfs_util.c b/lib/libzfs/libzfs_util.c index 301c8ddba..651bca297 100644 --- a/lib/libzfs/libzfs_util.c +++ b/lib/libzfs/libzfs_util.c @@ -1060,6 +1060,9 @@ libzfs_init(void) if ((error = zfs_nicestrtonum(hdl, env, &hdl->libzfs_max_nvlist))) { errno = error; + (void) close(hdl->libzfs_fd); + (void) fclose(hdl->libzfs_mnttab); + free(hdl); return (NULL); } } else { |