Skip to content

Commit

Permalink
confile: cleanup set_config_mount()
Browse files Browse the repository at this point in the history
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
  • Loading branch information
Christian Brauner committed Dec 15, 2020
1 parent 4d1683e commit d312dc0
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions src/lxc/confile.c
Expand Up @@ -2080,24 +2080,22 @@ static int set_config_mount_auto(const char *key, const char *value,
static int set_config_mount(const char *key, const char *value,
struct lxc_conf *lxc_conf, void *data)
{
char *mntelem;
struct lxc_list *mntlist;
__do_free char *mntelem = NULL;
__do_free struct lxc_list *mntlist = NULL;

if (lxc_config_value_empty(value))
return lxc_clear_mount_entries(lxc_conf);

mntlist = malloc(sizeof(*mntlist));
if (!mntlist)
return -1;
return ret_errno(ENOMEM);

mntelem = strdup(value);
if (!mntelem) {
free(mntlist);
return -1;
}
mntlist->elem = mntelem;
if (!mntelem)
return ret_errno(ENOMEM);

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;
}
Expand Down

0 comments on commit d312dc0

Please sign in to comment.