summaryrefslogtreecommitdiff
path: root/src/libsystemd/sd-bus/bus-kernel.c
diff options
context:
space:
mode:
authorCristian Rodríguez <crrodriguez@opensuse.org>2014-09-17 18:10:21 -0300
committerDaniel Mack <daniel@zonque.org>2014-09-18 10:13:09 +0200
commit4edf33d1e3fb551b1b0cee8e4a2a380c71b00dc7 (patch)
treecddbb9fbfa745e0bff0cbe064d26422677c5fc26 /src/libsystemd/sd-bus/bus-kernel.c
parent8c84621c25c563c7428f3d355136fc542389aab8 (diff)
Fix resource leak (coverity CID 1237760)
Diffstat (limited to 'src/libsystemd/sd-bus/bus-kernel.c')
-rw-r--r--src/libsystemd/sd-bus/bus-kernel.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/libsystemd/sd-bus/bus-kernel.c b/src/libsystemd/sd-bus/bus-kernel.c
index 505f335e07..b3cc996b1e 100644
--- a/src/libsystemd/sd-bus/bus-kernel.c
+++ b/src/libsystemd/sd-bus/bus-kernel.c
@@ -1446,9 +1446,11 @@ int bus_kernel_create_endpoint(const char *bus_name, const char *ep_name, char *
}
if (ep_path) {
- asprintf(ep_path, "%s/%s", dirname(path), ep_name);
- if (!*ep_path)
+ int r = asprintf(ep_path, "%s/%s", dirname(path), ep_name);
+ if (r == -1 || !*ep_path) {
+ safe_close(fd);
return -ENOMEM;
+ }
}
return fd;