summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Golle <daniel@makrotopia.org>2021-10-17 00:29:08 +0100
committerDaniel Golle <daniel@makrotopia.org>2021-10-17 19:33:51 +0100
commitd2a2eccbd145d246e3967aae0d75f20655426163 (patch)
treed9a892d36873826553e8c5337c3c907c30843650
parent9b1e035ad17ce762d8e42c213b29c6f433b72040 (diff)
downloadprocd-d2a2eccbd145d246e3967aae0d75f20655426163.tar.gz
jail: netifd: fix error handling issue reported by coverity
Check asprintf return value instead of checking for NULL-pointer. Coverity CID: 1492158 Unchecked return value Signed-off-by: Daniel Golle <daniel@makrotopia.org>
-rw-r--r--jail/netifd.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/jail/netifd.c b/jail/netifd.c
index 6096cfc..f6f2df6 100644
--- a/jail/netifd.c
+++ b/jail/netifd.c
@@ -425,14 +425,12 @@ int jail_network_start(struct ubus_context *new_ctx, char *new_jail_name, pid_t
ns_pid = new_ns_pid;
jail_name = new_jail_name;
- asprintf(&ubus_sock_dir, "/var/containers/ubus-%s", jail_name);
- if (!ubus_sock_dir) {
+ if (asprintf(&ubus_sock_dir, "/var/containers/ubus-%s", jail_name) == -1) {
ret = ENOMEM;
goto errout_dir;
}
- asprintf(&ubus_sock_path, "%s/ubus", ubus_sock_dir);
- if (!ubus_sock_path) {
+ if (asprintf(&ubus_sock_path, "%s/ubus", ubus_sock_dir) == -1) {
ret = ENOMEM;
goto errout_path;
}