confile: cleanup set_config_mount()

parent 138079ee
...@@ -2208,24 +2208,22 @@ static int set_config_mount_auto(const char *key, const char *value, ...@@ -2208,24 +2208,22 @@ static int set_config_mount_auto(const char *key, const char *value,
static int set_config_mount(const char *key, const char *value, static int set_config_mount(const char *key, const char *value,
struct lxc_conf *lxc_conf, void *data) struct lxc_conf *lxc_conf, void *data)
{ {
char *mntelem; __do_free char *mntelem = NULL;
struct lxc_list *mntlist; __do_free struct lxc_list *mntlist = NULL;
if (lxc_config_value_empty(value)) if (lxc_config_value_empty(value))
return lxc_clear_mount_entries(lxc_conf); return lxc_clear_mount_entries(lxc_conf);
mntlist = malloc(sizeof(*mntlist)); mntlist = malloc(sizeof(*mntlist));
if (!mntlist) if (!mntlist)
return -1; return ret_errno(ENOMEM);
mntelem = strdup(value); mntelem = strdup(value);
if (!mntelem) { if (!mntelem)
free(mntlist); return ret_errno(ENOMEM);
return -1;
}
mntlist->elem = mntelem;
lxc_list_add_tail(&lxc_conf->mount_list, mntlist); mntlist->elem = move_ptr(mntelem);
lxc_list_add_tail(&lxc_conf->mount_list, move_ptr(mntlist));
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