mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-22 02:27:36 +03:00
Fix userland resource leaks
Coverity caught these. With the exception of the file descriptor leak in tests/zfs-tests/cmd/draid.c, they are all memory leaks. Also, there is a piece of dead code in zfs_get_enclosure_sysfs_path(). We delete it as cleanup. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed-by: Ryan Moeller <ryan@iXsystems.com> Signed-off-by: Richard Yao <richard.yao@alumni.stonybrook.edu> Closes #13921
This commit is contained in:
@@ -233,13 +233,13 @@ drain_tree(zfs_btree_t *bt, char *why)
|
||||
void *ret;
|
||||
|
||||
u_longlong_t randval = random();
|
||||
node = malloc(sizeof (int_node_t));
|
||||
if ((p = (uint64_t *)zfs_btree_find(bt, &randval, &bt_idx)) !=
|
||||
NULL) {
|
||||
continue;
|
||||
}
|
||||
zfs_btree_add_idx(bt, &randval, &bt_idx);
|
||||
|
||||
node = malloc(sizeof (int_node_t));
|
||||
node->data = randval;
|
||||
if ((ret = avl_find(&avl, node, &avl_idx)) != NULL) {
|
||||
snprintf(why, BUFSIZE, "Found in avl: %llu\n", randval);
|
||||
|
||||
@@ -849,6 +849,7 @@ restart:
|
||||
if (rc < 0) {
|
||||
printf("Unable to read /dev/urandom: %s\n:",
|
||||
strerror(errno));
|
||||
close(fd);
|
||||
return (1);
|
||||
}
|
||||
bytes_read += rc;
|
||||
|
||||
Reference in New Issue
Block a user