The following pull request was submitted through Github. It can be accessed and reviewed at: https://github.com/lxc/lxc/pull/1940
This e-mail was sent by the LXC bot, direct replies will not reach the author unless they happen to be subscribed to this list. === Description (from pull-request) === Signed-off-by: Marcos Paulo de Souza <marcos.souza....@gmail.com>
From e15655b67ad46554bdd5ed9e28eb41da081b80e1 Mon Sep 17 00:00:00 2001 From: Marcos Paulo de Souza <marcos.souza....@gmail.com> Date: Wed, 22 Nov 2017 23:38:30 -0200 Subject: [PATCH] lxccontainer.c: Use calloc instead of malloc/memset Signed-off-by: Marcos Paulo de Souza <marcos.souza....@gmail.com> --- src/lxc/lxccontainer.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/lxc/lxccontainer.c b/src/lxc/lxccontainer.c index 413dd375b..b3e3222db 100644 --- a/src/lxc/lxccontainer.c +++ b/src/lxc/lxccontainer.c @@ -4408,11 +4408,10 @@ static int do_lxcapi_migrate(struct lxc_container *c, unsigned int cmd, * to initialize. */ if (size < sizeof(*opts)) { - valid_opts = malloc(sizeof(*opts)); + valid_opts = calloc(1, sizeof(*opts)); if (!valid_opts) return -ENOMEM; - memset(valid_opts, 0, sizeof(*opts)); memcpy(valid_opts, opts, size); } @@ -4516,12 +4515,11 @@ struct lxc_container *lxc_container_new(const char *name, const char *configpath if (!name) return NULL; - c = malloc(sizeof(*c)); + c = calloc(1, sizeof(*c)); if (!c) { fprintf(stderr, "failed to malloc lxc_container\n"); return NULL; } - memset(c, 0, sizeof(*c)); if (configpath) c->config_path = strdup(configpath);
_______________________________________________ lxc-devel mailing list lxc-devel@lists.linuxcontainers.org http://lists.linuxcontainers.org/listinfo/lxc-devel