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
1325d4b4
Unverified
Commit
1325d4b4
authored
Aug 04, 2020
by
Christian Brauner
Committed by
Stéphane Graber
Aug 04, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
conf: ensure that the idmap pointer itself is freed
Signed-off-by:
Christian Brauner
<
christian.brauner@ubuntu.com
>
parent
8bf37e96
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
8 deletions
+13
-8
conf.c
src/lxc/conf.c
+13
-8
No files found.
src/lxc/conf.c
View file @
1325d4b4
...
@@ -3415,7 +3415,14 @@ static int lxc_free_idmap(struct lxc_list *id_map)
...
@@ -3415,7 +3415,14 @@ static int lxc_free_idmap(struct lxc_list *id_map)
return
0
;
return
0
;
}
}
define_cleanup_function
(
struct
lxc_list
*
,
lxc_free_idmap
);
static
int
__lxc_free_idmap
(
struct
lxc_list
*
id_map
)
{
lxc_free_idmap
(
id_map
);
free
(
id_map
);
return
0
;
}
define_cleanup_function
(
struct
lxc_list
*
,
__lxc_free_idmap
);
int
lxc_clear_idmaps
(
struct
lxc_conf
*
c
)
int
lxc_clear_idmaps
(
struct
lxc_conf
*
c
)
{
{
...
@@ -3964,7 +3971,7 @@ static struct lxc_list *get_minimal_idmap(const struct lxc_conf *conf,
...
@@ -3964,7 +3971,7 @@ static struct lxc_list *get_minimal_idmap(const struct lxc_conf *conf,
int
userns_exec_1
(
const
struct
lxc_conf
*
conf
,
int
(
*
fn
)(
void
*
),
void
*
data
,
int
userns_exec_1
(
const
struct
lxc_conf
*
conf
,
int
(
*
fn
)(
void
*
),
void
*
data
,
const
char
*
fn_name
)
const
char
*
fn_name
)
{
{
call_cleaner
(
lxc_free_idmap
)
struct
lxc_list
*
idmap
=
NULL
;
call_cleaner
(
__
lxc_free_idmap
)
struct
lxc_list
*
idmap
=
NULL
;
int
ret
=
-
1
,
status
=
-
1
;
int
ret
=
-
1
,
status
=
-
1
;
char
c
=
'1'
;
char
c
=
'1'
;
struct
userns_fn_data
d
=
{
struct
userns_fn_data
d
=
{
...
@@ -4041,7 +4048,7 @@ int userns_exec_minimal(const struct lxc_conf *conf,
...
@@ -4041,7 +4048,7 @@ int userns_exec_minimal(const struct lxc_conf *conf,
int
(
*
fn_parent
)(
void
*
),
void
*
fn_parent_data
,
int
(
*
fn_parent
)(
void
*
),
void
*
fn_parent_data
,
int
(
*
fn_child
)(
void
*
),
void
*
fn_child_data
)
int
(
*
fn_child
)(
void
*
),
void
*
fn_child_data
)
{
{
call_cleaner
(
lxc_free_idmap
)
struct
lxc_list
*
idmap
=
NULL
;
call_cleaner
(
__
lxc_free_idmap
)
struct
lxc_list
*
idmap
=
NULL
;
uid_t
resuid
=
LXC_INVALID_UID
;
uid_t
resuid
=
LXC_INVALID_UID
;
gid_t
resgid
=
LXC_INVALID_GID
;
gid_t
resgid
=
LXC_INVALID_GID
;
char
c
=
'1'
;
char
c
=
'1'
;
...
@@ -4332,10 +4339,8 @@ on_error:
...
@@ -4332,10 +4339,8 @@ on_error:
if
(
pid
>
0
)
if
(
pid
>
0
)
ret
=
wait_for_pid
(
pid
);
ret
=
wait_for_pid
(
pid
);
if
(
idmap
)
{
if
(
idmap
)
lxc_free_idmap
(
idmap
);
__lxc_free_idmap
(
idmap
);
free
(
idmap
);
}
if
(
host_uid_map
&&
(
host_uid_map
!=
container_root_uid
))
if
(
host_uid_map
&&
(
host_uid_map
!=
container_root_uid
))
free
(
host_uid_map
);
free
(
host_uid_map
);
...
@@ -4376,7 +4381,7 @@ static int add_idmap_entry(struct lxc_list *idmap, enum idtype idtype,
...
@@ -4376,7 +4381,7 @@ static int add_idmap_entry(struct lxc_list *idmap, enum idtype idtype,
int
userns_exec_mapped_root
(
const
char
*
path
,
int
path_fd
,
int
userns_exec_mapped_root
(
const
char
*
path
,
int
path_fd
,
const
struct
lxc_conf
*
conf
)
const
struct
lxc_conf
*
conf
)
{
{
call_cleaner
(
lxc_free_idmap
)
struct
lxc_list
*
idmap
=
NULL
;
call_cleaner
(
__
lxc_free_idmap
)
struct
lxc_list
*
idmap
=
NULL
;
__do_close
int
fd
=
-
EBADF
;
__do_close
int
fd
=
-
EBADF
;
int
target_fd
=
-
EBADF
;
int
target_fd
=
-
EBADF
;
char
c
=
'1'
;
char
c
=
'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