confile: cleanup set_config_apparmor_raw()

parent 55a76891
...@@ -1504,26 +1504,22 @@ static int set_config_apparmor_raw(const char *key, ...@@ -1504,26 +1504,22 @@ static int set_config_apparmor_raw(const char *key,
struct lxc_conf *lxc_conf, struct lxc_conf *lxc_conf,
void *data) void *data)
{ {
char *elem; __do_free char *elem = NULL;
struct lxc_list *list; __do_free struct lxc_list *list = NULL;
if (lxc_config_value_empty(value)) if (lxc_config_value_empty(value))
return lxc_clear_apparmor_raw(lxc_conf); return lxc_clear_apparmor_raw(lxc_conf);
list = malloc(sizeof(*list)); list = malloc(sizeof(*list));
if (!list) { if (!list)
errno = ENOMEM; return ret_errno(ENOMEM);
return -1;
}
elem = strdup(value); elem = strdup(value);
if (!elem) { if (!elem)
free(list); return ret_errno(ENOMEM);
return -1;
}
list->elem = elem;
lxc_list_add_tail(&lxc_conf->lsm_aa_raw, list); list->elem = move_ptr(elem);
lxc_list_add_tail(&lxc_conf->lsm_aa_raw, move_ptr(list));
return 0; return 0;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment