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 <behlendorf1@llnl.gov>
Signed-off-by: luozhengzheng <luo.zhengzheng@zte.com.cn>
Closes #5209
start_progress_timer();
get_all_datasets(&dslist, &count, verbose);
- if (count == 0)
+ if (count == 0) {
+ if (options != NULL)
+ free(options);
return (0);
+ }
qsort(dslist, count, sizeof (void *), libzfs_dataset_cmp);
*/
/* Reopen MNTTAB to prevent reading stale data from open file */
- if (freopen(MNTTAB, "r", mnttab_file) == NULL)
+ if (freopen(MNTTAB, "r", mnttab_file) == NULL) {
+ if (options != NULL)
+ free(options);
return (ENOENT);
+ }
while (getmntent(mnttab_file, &entry) == 0) {
if (strcmp(entry.mnt_fstype, MNTTYPE_ZFS) != 0 ||
}
}
+ if (options != NULL)
+ free(options);
+
return (ret);
}
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;
if (fstat64_blk(fd, &st) == -1) {
err = errno;
close(fd);
+ if (dump_fd != -1)
+ close(dump_fd);
return (err);
}
{
int rv = CRYPTO_SUCCESS;
void *keysched;
- size_t size;
+ size_t size = 0;
if (template == NULL) {
if ((keysched = aes_alloc_keysched(&size, kmflag)) == NULL)