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
89f25263
Commit
89f25263
authored
Apr 06, 2015
by
Kien Truong
Committed by
Stéphane Graber
Jul 01, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Check malloc failure when sorting cgroup settings.
Signed-off-by:
Kien Truong
<
duckientruong@gmail.com
>
parent
6cc6ec01
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
0 deletions
+14
-0
cgfs.c
src/lxc/cgfs.c
+3
-0
cgmanager.c
src/lxc/cgmanager.c
+3
-0
conf.c
src/lxc/conf.c
+8
-0
No files found.
src/lxc/cgfs.c
View file @
89f25263
...
@@ -1895,6 +1895,9 @@ static int do_setup_cgroup_limits(struct cgfs_data *d,
...
@@ -1895,6 +1895,9 @@ static int do_setup_cgroup_limits(struct cgfs_data *d,
return
0
;
return
0
;
sorted_cgroup_settings
=
sort_cgroup_settings
(
cgroup_settings
);
sorted_cgroup_settings
=
sort_cgroup_settings
(
cgroup_settings
);
if
(
!
sorted_cgroup_settings
)
{
return
-
1
;
}
lxc_list_for_each
(
iterator
,
sorted_cgroup_settings
)
{
lxc_list_for_each
(
iterator
,
sorted_cgroup_settings
)
{
cg
=
iterator
->
elem
;
cg
=
iterator
->
elem
;
...
...
src/lxc/cgmanager.c
View file @
89f25263
...
@@ -1235,6 +1235,9 @@ static bool cgm_setup_limits(void *hdata, struct lxc_list *cgroup_settings, bool
...
@@ -1235,6 +1235,9 @@ static bool cgm_setup_limits(void *hdata, struct lxc_list *cgroup_settings, bool
}
}
sorted_cgroup_settings
=
sort_cgroup_settings
(
cgroup_settings
);
sorted_cgroup_settings
=
sort_cgroup_settings
(
cgroup_settings
);
if
(
!
sorted_cgroup_settings
)
{
return
false
;
}
lxc_list_for_each
(
iterator
,
sorted_cgroup_settings
)
{
lxc_list_for_each
(
iterator
,
sorted_cgroup_settings
)
{
char
controller
[
100
],
*
p
;
char
controller
[
100
],
*
p
;
...
...
src/lxc/conf.c
View file @
89f25263
...
@@ -4571,11 +4571,19 @@ struct lxc_list *sort_cgroup_settings(struct lxc_list* cgroup_settings)
...
@@ -4571,11 +4571,19 @@ struct lxc_list *sort_cgroup_settings(struct lxc_list* cgroup_settings)
struct
lxc_list
*
item
=
NULL
;
struct
lxc_list
*
item
=
NULL
;
result
=
malloc
(
sizeof
(
*
result
));
result
=
malloc
(
sizeof
(
*
result
));
if
(
!
result
)
{
ERROR
(
"failed to allocate memory to sort cgroup settings"
);
return
NULL
;
}
lxc_list_init
(
result
);
lxc_list_init
(
result
);
/*Iterate over the cgroup settings and copy them to the output list*/
/*Iterate over the cgroup settings and copy them to the output list*/
lxc_list_for_each
(
it
,
cgroup_settings
)
{
lxc_list_for_each
(
it
,
cgroup_settings
)
{
item
=
malloc
(
sizeof
(
*
item
));
item
=
malloc
(
sizeof
(
*
item
));
if
(
!
item
)
{
ERROR
(
"failed to allocate memory to sort cgroup settings"
);
return
NULL
;
}
item
->
elem
=
it
->
elem
;
item
->
elem
=
it
->
elem
;
cg
=
it
->
elem
;
cg
=
it
->
elem
;
if
(
strcmp
(
cg
->
subsystem
,
"memory.memsw.limit_in_bytes"
)
==
0
)
{
if
(
strcmp
(
cg
->
subsystem
,
"memory.memsw.limit_in_bytes"
)
==
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