2020-03-01 22:54:01 -05:00
|
|
|
From 3e73fc4707851601f3538502e8364a1550da2741 Mon Sep 17 00:00:00 2001
|
2019-09-30 11:03:07 -04:00
|
|
|
From: LiFeng <lifeng68@huawei.com>
|
|
|
|
|
Date: Mon, 3 Jun 2019 23:02:50 -0400
|
2020-03-01 22:54:01 -05:00
|
|
|
Subject: [PATCH 105/140] lxc: fix code error warnings
|
2019-09-30 11:03:07 -04:00
|
|
|
|
|
|
|
|
Signed-off-by: LiFeng <lifeng68@huawei.com>
|
|
|
|
|
---
|
|
|
|
|
src/lxc/conf.c | 5 ++++-
|
|
|
|
|
src/lxc/lxccontainer.c | 3 +--
|
|
|
|
|
src/lxc/start.c | 2 +-
|
|
|
|
|
3 files changed, 6 insertions(+), 4 deletions(-)
|
|
|
|
|
|
|
|
|
|
diff --git a/src/lxc/conf.c b/src/lxc/conf.c
|
2020-01-05 22:20:49 -05:00
|
|
|
index 127ef77..8311723 100644
|
2019-09-30 11:03:07 -04:00
|
|
|
--- a/src/lxc/conf.c
|
|
|
|
|
+++ b/src/lxc/conf.c
|
|
|
|
|
@@ -5325,9 +5325,12 @@ int lxc_clear_init_args(struct lxc_conf *lxc_conf)
|
|
|
|
|
{
|
|
|
|
|
int i;
|
|
|
|
|
|
|
|
|
|
- for (i = 0; i < lxc_conf->init_argc; i++)
|
|
|
|
|
+ for (i = 0; i < lxc_conf->init_argc; i++) {
|
|
|
|
|
free(lxc_conf->init_argv[i]);
|
|
|
|
|
+ lxc_conf->init_argv[i] = NULL;
|
|
|
|
|
+ }
|
|
|
|
|
free(lxc_conf->init_argv);
|
|
|
|
|
+ lxc_conf->init_argv = NULL;
|
|
|
|
|
lxc_conf->init_argc = 0;
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
diff --git a/src/lxc/lxccontainer.c b/src/lxc/lxccontainer.c
|
2020-01-05 22:20:49 -05:00
|
|
|
index 72417ed..a09e066 100644
|
2019-09-30 11:03:07 -04:00
|
|
|
--- a/src/lxc/lxccontainer.c
|
|
|
|
|
+++ b/src/lxc/lxccontainer.c
|
|
|
|
|
@@ -1180,6 +1180,7 @@ static bool do_lxcapi_start(struct lxc_container *c, int useinit, char * const a
|
|
|
|
|
if (conf->exit_fd < 0) {
|
|
|
|
|
ERROR("Failed to open exit fifo %s: %s.", c->exit_fifo, strerror(errno));
|
|
|
|
|
ret = 1;
|
|
|
|
|
+ lxc_free_handler(handler);
|
|
|
|
|
goto on_error;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@@ -1208,7 +1209,6 @@ static bool do_lxcapi_start(struct lxc_container *c, int useinit, char * const a
|
|
|
|
|
reboot:
|
|
|
|
|
if (conf->reboot == REBOOT_INIT) {
|
|
|
|
|
/* initialize handler */
|
|
|
|
|
- lxc_free_handler(handler);
|
|
|
|
|
handler = lxc_init_handler(c->name, conf, c->config_path, c->daemonize);
|
|
|
|
|
if (!handler) {
|
|
|
|
|
ret = 1;
|
|
|
|
|
@@ -1249,7 +1249,6 @@ reboot:
|
|
|
|
|
conf->reboot = REBOOT_INIT;
|
|
|
|
|
goto reboot;
|
|
|
|
|
}
|
|
|
|
|
- lxc_free_handler(handler);
|
|
|
|
|
|
|
|
|
|
on_error:
|
|
|
|
|
if (c->pidfile) {
|
|
|
|
|
diff --git a/src/lxc/start.c b/src/lxc/start.c
|
2020-01-05 22:20:49 -05:00
|
|
|
index ccdd844..2380581 100644
|
2019-09-30 11:03:07 -04:00
|
|
|
--- a/src/lxc/start.c
|
|
|
|
|
+++ b/src/lxc/start.c
|
|
|
|
|
@@ -2421,7 +2421,7 @@ int __lxc_start(const char *name, struct lxc_handler *handler,
|
|
|
|
|
ret = lxc_init(name, handler);
|
|
|
|
|
if (ret < 0) {
|
|
|
|
|
ERROR("Failed to initialize container \"%s\"", name);
|
|
|
|
|
- return -1;
|
|
|
|
|
+ goto out_fini_nonet;
|
|
|
|
|
}
|
|
|
|
|
handler->ops = ops;
|
|
|
|
|
handler->data = data;
|
|
|
|
|
--
|
2020-01-05 22:20:49 -05:00
|
|
|
1.8.3.1
|
2019-09-30 11:03:07 -04:00
|
|
|
|