Signed-off-by: Kien Truong <duckientruong@gmail.com>
return 0;
sorted_cgroup_settings = sort_cgroup_settings(cgroup_settings);
+ if (!sorted_cgroup_settings) {
+ return -1;
+ }
lxc_list_for_each(iterator, sorted_cgroup_settings) {
cg = iterator->elem;
}
sorted_cgroup_settings = sort_cgroup_settings(cgroup_settings);
+ if (!sorted_cgroup_settings) {
+ return false;
+ }
lxc_list_for_each(iterator, sorted_cgroup_settings) {
char controller[100], *p;
struct lxc_list *item = NULL;
result = malloc(sizeof(*result));
+ if (!result) {
+ ERROR("failed to allocate memory to sort cgroup settings");
+ return NULL;
+ }
lxc_list_init(result);
/*Iterate over the cgroup settings and copy them to the output list*/
lxc_list_for_each(it, cgroup_settings) {
item = malloc(sizeof(*item));
+ if (!item) {
+ ERROR("failed to allocate memory to sort cgroup settings");
+ return NULL;
+ }
item->elem = it->elem;
cg = it->elem;
if (strcmp(cg->subsystem, "memory.memsw.limit_in_bytes") == 0) {