core: add missing oom check
authorYu Watanabe <watanabe.yu+github@gmail.com>
Mon, 9 Nov 2020 14:59:36 +0000 (23:59 +0900)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Tue, 8 Dec 2020 17:08:31 +0000 (18:08 +0100)
Fixes #17552.

(cherry picked from commit 72585a584d26eec4bb9ea6c30fc101f1e4f0d7f9)

src/core/socket.c

index f2be28ff783bb1612afd5afe2bbf8cb84d420327..1a2256c867406f67479aa871a460975566bc8f55 100644 (file)
@@ -1720,6 +1720,8 @@ static int socket_open_fds(Socket *_s) {
                         _cleanup_free_ char *ep = NULL;
 
                         ep = path_make_absolute("ep0", p->path);
+                        if (!ep)
+                                return -ENOMEM;
 
                         p->fd = usbffs_address_create(ep);
                         if (p->fd < 0)