Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
L
lxc
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Chen Yisong
lxc
Commits
a1232a57
Unverified
Commit
a1232a57
authored
Apr 15, 2020
by
Christian Brauner
Committed by
Stéphane Graber
Apr 15, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
zfs: fix resource leak
Fixes: Coverity 1461730. Signed-off-by:
Christian Brauner
<
christian.brauner@ubuntu.com
>
parent
c89533f4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
5 deletions
+1
-5
zfs.c
src/lxc/storage/zfs.c
+1
-5
No files found.
src/lxc/storage/zfs.c
View file @
a1232a57
...
...
@@ -159,8 +159,8 @@ bool zfs_detect(const char *path)
int
zfs_mount
(
struct
lxc_storage
*
bdev
)
{
__do_free
char
*
mntdata
=
NULL
;
unsigned
long
mntflags
=
0
;
char
*
mntdata
=
NULL
;
int
ret
;
size_t
oldlen
,
newlen
,
totallen
;
char
*
tmp
;
...
...
@@ -176,7 +176,6 @@ int zfs_mount(struct lxc_storage *bdev)
ret
=
parse_mntopts
(
bdev
->
mntopts
,
&
mntflags
,
&
mntdata
);
if
(
ret
<
0
)
{
ERROR
(
"Failed to parse mount options"
);
free
(
mntdata
);
return
-
22
;
}
...
...
@@ -221,7 +220,6 @@ int zfs_mount(struct lxc_storage *bdev)
tmp
=
realloc
(
mntdata
,
totallen
);
if
(
!
tmp
)
{
ERROR
(
"Failed to reallocate memory"
);
free
(
mntdata
);
return
-
1
;
}
mntdata
=
tmp
;
...
...
@@ -229,12 +227,10 @@ int zfs_mount(struct lxc_storage *bdev)
ret
=
snprintf
((
mntdata
+
oldlen
),
newlen
,
",zfsutil,mntpoint=%s"
,
src
);
if
(
ret
<
0
||
(
size_t
)
ret
>=
newlen
)
{
ERROR
(
"Failed to create string"
);
free
(
mntdata
);
return
-
1
;
}
ret
=
mount
(
src
,
bdev
->
dest
,
"zfs"
,
mntflags
,
mntdata
);
free
(
mntdata
);
if
(
ret
<
0
&&
errno
!=
EBUSY
)
{
SYSERROR
(
"Failed to mount
\"
%s
\"
on
\"
%s
\"
"
,
src
,
bdev
->
dest
);
return
-
1
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment