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
d1ea3f93
Unverified
Commit
d1ea3f93
authored
Jun 21, 2017
by
Li Feng
Committed by
Christian Brauner
Nov 29, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix memory leak of 'lxc_tty_state'
Signed-off-by:
Li Feng
<
lifeng68@huawei.com
>
parent
27807cc8
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
6 deletions
+8
-6
console.c
src/lxc/console.c
+8
-6
No files found.
src/lxc/console.c
View file @
d1ea3f93
...
@@ -135,6 +135,7 @@ struct lxc_tty_state *lxc_console_sigwinch_init(int srcfd, int dstfd)
...
@@ -135,6 +135,7 @@ struct lxc_tty_state *lxc_console_sigwinch_init(int srcfd, int dstfd)
if
(
sigprocmask
(
SIG_BLOCK
,
&
mask
,
&
ts
->
oldmask
))
{
if
(
sigprocmask
(
SIG_BLOCK
,
&
mask
,
&
ts
->
oldmask
))
{
SYSERROR
(
"failed to block SIGWINCH"
);
SYSERROR
(
"failed to block SIGWINCH"
);
ts
->
sigfd
=
-
1
;
ts
->
sigfd
=
-
1
;
lxc_list_del
(
&
ts
->
node
);
return
ts
;
return
ts
;
}
}
...
@@ -143,6 +144,7 @@ struct lxc_tty_state *lxc_console_sigwinch_init(int srcfd, int dstfd)
...
@@ -143,6 +144,7 @@ struct lxc_tty_state *lxc_console_sigwinch_init(int srcfd, int dstfd)
SYSERROR
(
"failed to create signal fd"
);
SYSERROR
(
"failed to create signal fd"
);
sigprocmask
(
SIG_SETMASK
,
&
ts
->
oldmask
,
NULL
);
sigprocmask
(
SIG_SETMASK
,
&
ts
->
oldmask
,
NULL
);
ts
->
sigfd
=
-
1
;
ts
->
sigfd
=
-
1
;
lxc_list_del
(
&
ts
->
node
);
return
ts
;
return
ts
;
}
}
...
@@ -152,11 +154,12 @@ struct lxc_tty_state *lxc_console_sigwinch_init(int srcfd, int dstfd)
...
@@ -152,11 +154,12 @@ struct lxc_tty_state *lxc_console_sigwinch_init(int srcfd, int dstfd)
void
lxc_console_sigwinch_fini
(
struct
lxc_tty_state
*
ts
)
void
lxc_console_sigwinch_fini
(
struct
lxc_tty_state
*
ts
)
{
{
if
(
ts
->
sigfd
>=
0
)
if
(
ts
->
sigfd
>=
0
)
{
close
(
ts
->
sigfd
);
close
(
ts
->
sigfd
);
lxc_list_del
(
&
ts
->
node
);
sigprocmask
(
SIG_SETMASK
,
&
ts
->
oldmask
,
NULL
);
}
lxc_list_del
(
&
ts
->
node
);
sigprocmask
(
SIG_SETMASK
,
&
ts
->
oldmask
,
NULL
);
free
(
ts
);
free
(
ts
);
}
}
...
@@ -306,7 +309,7 @@ int lxc_setup_tios(int fd, struct termios *oldtios)
...
@@ -306,7 +309,7 @@ int lxc_setup_tios(int fd, struct termios *oldtios)
static
void
lxc_console_peer_proxy_free
(
struct
lxc_console
*
console
)
static
void
lxc_console_peer_proxy_free
(
struct
lxc_console
*
console
)
{
{
if
(
console
->
tty_state
&&
console
->
tty_state
->
sigfd
!=
-
1
)
{
if
(
console
->
tty_state
)
{
lxc_console_sigwinch_fini
(
console
->
tty_state
);
lxc_console_sigwinch_fini
(
console
->
tty_state
);
console
->
tty_state
=
NULL
;
console
->
tty_state
=
NULL
;
}
}
...
@@ -747,8 +750,7 @@ int lxc_console(struct lxc_container *c, int ttynum,
...
@@ -747,8 +750,7 @@ int lxc_console(struct lxc_container *c, int ttynum,
err4
:
err4
:
lxc_mainloop_close
(
&
descr
);
lxc_mainloop_close
(
&
descr
);
err3
:
err3
:
if
(
ts
->
sigfd
!=
-
1
)
lxc_console_sigwinch_fini
(
ts
);
lxc_console_sigwinch_fini
(
ts
);
err2
:
err2
:
close
(
masterfd
);
close
(
masterfd
);
close
(
ttyfd
);
close
(
ttyfd
);
...
...
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