lxc/0105-lxc-fix-code-error-warnings.patch

75 lines
2.1 KiB
Diff
Raw Normal View History

2019-12-25 15:57:42 +08:00
From 9f0429283bfb550036831afcc19026963d42a4e8 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
2019-12-25 15:57:42 +08:00
Subject: [PATCH 105/131] 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
2019-12-25 15:57:42 +08:00
index 127ef77b..83117238 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
2019-12-25 15:57:42 +08:00
index 72417ed6..a09e066a 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
2019-12-25 15:57:42 +08:00
index ccdd844c..2380581f 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;
--
2019-12-25 15:57:42 +08:00
2.23.0
2019-09-30 11:03:07 -04:00