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
e7de366c
Commit
e7de366c
authored
Feb 12, 2014
by
Stéphane Graber
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
coverity: Free bdev in clone_update_rootfs
Signed-off-by:
Stéphane Graber
<
stgraber@ubuntu.com
>
Acked-by:
Serge E. Hallyn
<
serge.hallyn@ubuntu.com
>
parent
50798138
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
1 deletion
+10
-1
lxccontainer.c
src/lxc/lxccontainer.c
+10
-1
No files found.
src/lxc/lxccontainer.c
View file @
e7de366c
...
@@ -2498,10 +2498,13 @@ static int clone_update_rootfs(struct clone_update_data *data)
...
@@ -2498,10 +2498,13 @@ static int clone_update_rootfs(struct clone_update_data *data)
if
(
strcmp
(
bdev
->
type
,
"dir"
)
!=
0
)
{
if
(
strcmp
(
bdev
->
type
,
"dir"
)
!=
0
)
{
if
(
unshare
(
CLONE_NEWNS
)
<
0
)
{
if
(
unshare
(
CLONE_NEWNS
)
<
0
)
{
ERROR
(
"error unsharing mounts"
);
ERROR
(
"error unsharing mounts"
);
bdev_put
(
bdev
);
return
-
1
;
return
-
1
;
}
}
if
(
bdev
->
ops
->
mount
(
bdev
)
<
0
)
if
(
bdev
->
ops
->
mount
(
bdev
)
<
0
)
{
bdev_put
(
bdev
);
return
-
1
;
return
-
1
;
}
}
else
{
// TODO come up with a better way
}
else
{
// TODO come up with a better way
if
(
bdev
->
dest
)
if
(
bdev
->
dest
)
free
(
bdev
->
dest
);
free
(
bdev
->
dest
);
...
@@ -2528,12 +2531,15 @@ static int clone_update_rootfs(struct clone_update_data *data)
...
@@ -2528,12 +2531,15 @@ static int clone_update_rootfs(struct clone_update_data *data)
if
(
run_lxc_hooks
(
c
->
name
,
"clone"
,
conf
,
c
->
get_config_path
(
c
),
hookargs
))
{
if
(
run_lxc_hooks
(
c
->
name
,
"clone"
,
conf
,
c
->
get_config_path
(
c
),
hookargs
))
{
ERROR
(
"Error executing clone hook for %s"
,
c
->
name
);
ERROR
(
"Error executing clone hook for %s"
,
c
->
name
);
bdev_put
(
bdev
);
return
-
1
;
return
-
1
;
}
}
}
}
if
(
!
(
flags
&
LXC_CLONE_KEEPNAME
))
{
if
(
!
(
flags
&
LXC_CLONE_KEEPNAME
))
{
ret
=
snprintf
(
path
,
MAXPATHLEN
,
"%s/etc/hostname"
,
bdev
->
dest
);
ret
=
snprintf
(
path
,
MAXPATHLEN
,
"%s/etc/hostname"
,
bdev
->
dest
);
bdev_put
(
bdev
);
if
(
ret
<
0
||
ret
>=
MAXPATHLEN
)
if
(
ret
<
0
||
ret
>=
MAXPATHLEN
)
return
-
1
;
return
-
1
;
if
(
!
file_exists
(
path
))
if
(
!
file_exists
(
path
))
...
@@ -2549,6 +2555,9 @@ static int clone_update_rootfs(struct clone_update_data *data)
...
@@ -2549,6 +2555,9 @@ static int clone_update_rootfs(struct clone_update_data *data)
if
(
fclose
(
fout
)
<
0
)
if
(
fclose
(
fout
)
<
0
)
return
-
1
;
return
-
1
;
}
}
else
bdev_put
(
bdev
);
return
0
;
return
0
;
}
}
...
...
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