mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2024-12-25 18:59:33 +03:00
Fix coverity defects: CID 147613 147614 147616 147617
coverity scan CID:147617,type: resource leaks coverity scan CID:147616,type: resource leaks coverity scan CID:147614,type: resource leaks coverity scan CID:147613,type: resource leaks Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: luozhengzheng <luo.zhengzheng@zte.com.cn> Closes #5150
This commit is contained in:
parent
d5b897a6a1
commit
d0662a1beb
@ -170,8 +170,11 @@ split_string(const char *optarg, char *pattern, range_repeat_t *range)
|
||||
* value of the * first argument, starts searching from the
|
||||
* saved pointer and behaves as described above.
|
||||
*/
|
||||
token[i] = strtok(cp, comma);
|
||||
cp = NULL;
|
||||
if (i == 0) {
|
||||
token[i] = strtok(cp, comma);
|
||||
} else {
|
||||
token[i] = strtok(NULL, comma);
|
||||
}
|
||||
} while ((token[i++] != NULL) && (i < 32));
|
||||
|
||||
range->val_count = i - 1;
|
||||
@ -260,12 +263,13 @@ set_noise(uint64_t *noise, char *optarg, char *arg)
|
||||
int
|
||||
set_load_params(cmd_args_t *args, char *optarg)
|
||||
{
|
||||
char *param, *search, comma[] = ",";
|
||||
char *param, *search, *searchdup, comma[] = ",";
|
||||
int rc = 0;
|
||||
|
||||
search = strdup(optarg);
|
||||
if (search == NULL)
|
||||
return (ENOMEM);
|
||||
searchdup = search;
|
||||
|
||||
while ((param = strtok(search, comma)) != NULL) {
|
||||
search = NULL;
|
||||
@ -283,7 +287,7 @@ set_load_params(cmd_args_t *args, char *optarg)
|
||||
}
|
||||
}
|
||||
|
||||
free(search);
|
||||
free(searchdup);
|
||||
|
||||
return (rc);
|
||||
}
|
||||
|
@ -252,6 +252,7 @@ drop_caches(void)
|
||||
rc = write(fd, "3", 1);
|
||||
if ((rc == -1) || (rc != 1)) {
|
||||
ERROR("Error %d: write(%d, \"3\", 1)\n", errno, fd);
|
||||
(void) close(fd);
|
||||
return (errno);
|
||||
}
|
||||
|
||||
@ -630,6 +631,7 @@ unlink_files(void)
|
||||
rc = unlink(file);
|
||||
if ((rc == -1) && (errno != ENOENT)) {
|
||||
ERROR("Error %d: unlink(%s)\n", errno, file);
|
||||
free(file);
|
||||
return (errno);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user