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
cf605ce7
Unverified
Commit
cf605ce7
authored
Jun 29, 2017
by
Christian Brauner
Committed by
Stéphane Graber
Jul 16, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lxccontainer: make sure memory is free()ed
Signed-off-by:
Christian Brauner
<
christian.brauner@ubuntu.com
>
parent
b42041e4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
11 deletions
+20
-11
lxccontainer.c
src/lxc/lxccontainer.c
+20
-11
No files found.
src/lxc/lxccontainer.c
View file @
cf605ce7
...
...
@@ -844,6 +844,7 @@ static bool do_lxcapi_start(struct lxc_container *c, int useinit, char * const a
* while container is running...
*/
if
(
daemonize
)
{
bool
started
;
char
title
[
2048
];
pid_t
pid
;
...
...
@@ -860,11 +861,11 @@ static bool do_lxcapi_start(struct lxc_container *c, int useinit, char * const a
*/
c
->
pidfile
=
NULL
;
/* Prevent leaking the command socket to the second
* fork().
*/
close
(
handler
->
conf
->
maincmd_fd
);
return
wait_on_daemonized_start
(
handler
,
pid
)
;
started
=
wait_on_daemonized_start
(
handler
,
pid
);
free_init_cmd
(
init_cmd
);
lxc_free_handler
(
handler
);
return
started
;
}
/* We don't really care if this doesn't print all the
...
...
@@ -881,8 +882,13 @@ static bool do_lxcapi_start(struct lxc_container *c, int useinit, char * const a
SYSERROR
(
"Error doing dual-fork"
);
exit
(
1
);
}
if
(
pid
!=
0
)
if
(
pid
!=
0
)
{
free_init_cmd
(
init_cmd
);
lxc_free_handler
(
handler
);
exit
(
0
);
}
/* like daemon(), chdir to / and redirect 0,1,2 to /dev/null */
if
(
chdir
(
"/"
))
{
SYSERROR
(
"Error chdir()ing to /."
);
...
...
@@ -901,6 +907,7 @@ static bool do_lxcapi_start(struct lxc_container *c, int useinit, char * const a
}
else
{
if
(
!
am_single_threaded
())
{
ERROR
(
"Cannot start non-daemonized container when threaded"
);
free_init_cmd
(
init_cmd
);
lxc_free_handler
(
handler
);
return
false
;
}
...
...
@@ -942,15 +949,15 @@ static bool do_lxcapi_start(struct lxc_container *c, int useinit, char * const a
if
(
conf
->
monitor_unshare
)
{
if
(
unshare
(
CLONE_NEWNS
))
{
SYSERROR
(
"failed to unshare mount namespace"
);
free_init_cmd
(
init_cmd
);
lxc_free_handler
(
handler
);
return
false
;
ret
=
1
;
goto
out
;
}
if
(
mount
(
NULL
,
"/"
,
NULL
,
MS_SLAVE
|
MS_REC
,
NULL
))
{
SYSERROR
(
"Failed to make / rslave at startup"
);
free_init_cmd
(
init_cmd
);
lxc_free_handler
(
handler
);
return
false
;
ret
=
1
;
goto
out
;
}
}
...
...
@@ -958,8 +965,10 @@ reboot:
if
(
conf
->
reboot
==
2
)
{
/* initialize handler */
handler
=
lxc_init_handler
(
c
->
name
,
conf
,
c
->
config_path
,
daemonize
);
if
(
!
handler
)
if
(
!
handler
)
{
ret
=
1
;
goto
out
;
}
}
if
(
lxc_check_inherited
(
conf
,
daemonize
,
...
...
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