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
0d219ea1
Unverified
Commit
0d219ea1
authored
Dec 09, 2017
by
Christian Brauner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
coverity: #1425866
free allocated memory Signed-off-by:
Christian Brauner
<
christian.brauner@ubuntu.com
>
parent
0b01bd4d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
2 deletions
+11
-2
attach.c
src/lxc/attach.c
+11
-2
No files found.
src/lxc/attach.c
View file @
0d219ea1
...
@@ -859,13 +859,17 @@ int lxc_attach(const char *name, const char *lxcpath,
...
@@ -859,13 +859,17 @@ int lxc_attach(const char *name, const char *lxcpath,
init_ctx
->
personality
=
personality
;
init_ctx
->
personality
=
personality
;
init_ctx
->
container
=
lxc_container_new
(
name
,
lxcpath
);
init_ctx
->
container
=
lxc_container_new
(
name
,
lxcpath
);
if
(
!
init_ctx
->
container
)
if
(
!
init_ctx
->
container
)
{
lxc_proc_put_context_info
(
init_ctx
);
return
-
1
;
return
-
1
;
}
if
(
!
init_ctx
->
container
->
lxc_conf
)
{
if
(
!
init_ctx
->
container
->
lxc_conf
)
{
init_ctx
->
container
->
lxc_conf
=
lxc_conf_init
();
init_ctx
->
container
->
lxc_conf
=
lxc_conf_init
();
if
(
!
init_ctx
->
container
->
lxc_conf
)
if
(
!
init_ctx
->
container
->
lxc_conf
)
{
lxc_proc_put_context_info
(
init_ctx
);
return
-
ENOMEM
;
return
-
ENOMEM
;
}
}
}
if
(
!
fetch_seccomp
(
init_ctx
->
container
,
options
))
if
(
!
fetch_seccomp
(
init_ctx
->
container
,
options
))
...
@@ -1166,6 +1170,7 @@ int lxc_attach(const char *name, const char *lxcpath,
...
@@ -1166,6 +1170,7 @@ int lxc_attach(const char *name, const char *lxcpath,
if
(
ret
<=
0
)
{
if
(
ret
<=
0
)
{
ERROR
(
"Expected to receive sequence number 0: %s."
,
strerror
(
errno
));
ERROR
(
"Expected to receive sequence number 0: %s."
,
strerror
(
errno
));
shutdown
(
ipc_sockets
[
1
],
SHUT_RDWR
);
shutdown
(
ipc_sockets
[
1
],
SHUT_RDWR
);
lxc_proc_put_context_info
(
init_ctx
);
rexit
(
-
1
);
rexit
(
-
1
);
}
}
...
@@ -1176,6 +1181,7 @@ int lxc_attach(const char *name, const char *lxcpath,
...
@@ -1176,6 +1181,7 @@ int lxc_attach(const char *name, const char *lxcpath,
if
(
ret
<
0
)
{
if
(
ret
<
0
)
{
ERROR
(
"Failed to enter namespaces."
);
ERROR
(
"Failed to enter namespaces."
);
shutdown
(
ipc_sockets
[
1
],
SHUT_RDWR
);
shutdown
(
ipc_sockets
[
1
],
SHUT_RDWR
);
lxc_proc_put_context_info
(
init_ctx
);
rexit
(
-
1
);
rexit
(
-
1
);
}
}
/* close namespace file descriptors */
/* close namespace file descriptors */
...
@@ -1214,6 +1220,7 @@ int lxc_attach(const char *name, const char *lxcpath,
...
@@ -1214,6 +1220,7 @@ int lxc_attach(const char *name, const char *lxcpath,
if
(
pid
<=
0
)
{
if
(
pid
<=
0
)
{
SYSERROR
(
"Failed to create subprocess."
);
SYSERROR
(
"Failed to create subprocess."
);
shutdown
(
ipc_sockets
[
1
],
SHUT_RDWR
);
shutdown
(
ipc_sockets
[
1
],
SHUT_RDWR
);
lxc_proc_put_context_info
(
init_ctx
);
rexit
(
-
1
);
rexit
(
-
1
);
}
}
...
@@ -1228,10 +1235,12 @@ int lxc_attach(const char *name, const char *lxcpath,
...
@@ -1228,10 +1235,12 @@ int lxc_attach(const char *name, const char *lxcpath,
*/
*/
ERROR
(
"Intended to send pid %d: %s."
,
pid
,
strerror
(
errno
));
ERROR
(
"Intended to send pid %d: %s."
,
pid
,
strerror
(
errno
));
shutdown
(
ipc_sockets
[
1
],
SHUT_RDWR
);
shutdown
(
ipc_sockets
[
1
],
SHUT_RDWR
);
lxc_proc_put_context_info
(
init_ctx
);
rexit
(
-
1
);
rexit
(
-
1
);
}
}
/* The rest is in the hands of the initial and the attached process. */
/* The rest is in the hands of the initial and the attached process. */
lxc_proc_put_context_info
(
init_ctx
);
rexit
(
0
);
rexit
(
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