mirror of
https://github.com/kdave/btrfs-progs
synced 2024-12-25 23:52:17 +00:00
btrfs-progs: fix resource leak in scrub_start()
Resolves-Coverity-CID: 1125934 Resolves-Coverity-CID: 1125935 Resolves-Coverity-CID: 1125936 Signed-off-by: Eric Sandeen <sandeen@redhat.com> Signed-off-by: Wang Shilong <wangsl.fnst@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <clm@fb.com>
This commit is contained in:
parent
70749a77fe
commit
fd777c3695
@ -1097,6 +1097,7 @@ static int scrub_start(int argc, char **argv, int resume)
|
||||
u64 devid;
|
||||
DIR *dirstream = NULL;
|
||||
int force = 0;
|
||||
int nothing_to_resume = 0;
|
||||
|
||||
optind = 1;
|
||||
while ((c = getopt(argc, argv, "BdqrRc:n:f")) != -1) {
|
||||
@ -1265,7 +1266,8 @@ static int scrub_start(int argc, char **argv, int resume)
|
||||
if (!do_quiet)
|
||||
printf("scrub: nothing to resume for %s, fsid %s\n",
|
||||
path, fsid);
|
||||
return 2;
|
||||
nothing_to_resume = 1;
|
||||
goto out;
|
||||
}
|
||||
|
||||
ret = prg_fd = socket(AF_UNIX, SOCK_STREAM, 0);
|
||||
@ -1501,6 +1503,8 @@ out:
|
||||
}
|
||||
close_file_or_dir(fdmnt, dirstream);
|
||||
|
||||
if (nothing_to_resume)
|
||||
return 2;
|
||||
if (err)
|
||||
return 1;
|
||||
if (e_correctable)
|
||||
|
Loading…
Reference in New Issue
Block a user