summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Golle <daniel@makrotopia.org>2021-12-26 12:06:38 +0000
committerDaniel Golle <daniel@makrotopia.org>2021-12-26 12:06:38 +0000
commite083dd4821e3c39435a19c58899fae7a5ae60e24 (patch)
tree4241236d539e24e44d14cccea24963eaa3362cd3
parentca6c35c8eb8fe668c3a27a27fde14ef87255c13d (diff)
downloadprocd-e083dd4821e3c39435a19c58899fae7a5ae60e24.tar.gz
uxc: fix two minor issues reported by Coverity
Fixes CID 1496022 (UNINIT) and CID 1496023 (RESOURCE_LEAK). Signed-off-by: Daniel Golle <daniel@makrotopia.org>
-rw-r--r--uxc.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/uxc.c b/uxc.c
index 2a6df54..b603086 100644
--- a/uxc.c
+++ b/uxc.c
@@ -151,7 +151,8 @@ static int conf_load(void)
if (asprintf(&globstr, "%s/*.json", UXC_ETC_CONFDIR) == -1)
return ENOMEM;
- if (glob(globstr, gl_flags, NULL, &gl) == 0)
+ res = glob(globstr, gl_flags, NULL, &gl);
+ if (res == 0)
gl_flags |= GLOB_APPEND;
free(globstr);
@@ -495,6 +496,7 @@ static int uxc_attach(const char *container_name)
if (ubus_lookup_id(ctx, "container", &id) ||
ubus_invoke_fd(ctx, id, "console_attach", req.head, NULL, NULL, 3000, server_fd)) {
fprintf(stderr, "ubus request failed\n");
+ close(tty_fd);
close(server_fd);
close(client_fd);
blob_buf_free(&req);