1
0
mirror of https://github.com/systemd/systemd.git synced 2024-10-28 03:25:31 +03:00

Fix resource leak (coverity CID 1237760)

This commit is contained in:
Cristian Rodríguez 2014-09-17 18:10:21 -03:00 committed by Daniel Mack
parent 8c84621c25
commit 4edf33d1e3

View File

@ -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;