uxc: fix two minor issues reported by Coverity
[project/procd.git] / uxc.c
diff --git a/uxc.c b/uxc.c
index 2a6df546a1ecddcb97be9f3cb1164dad54a9a218..b6030864f87417e3f0f11bb66c7ac41b2ce2f9cd 100644 (file)
--- 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);