summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/socket.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/socket.c b/src/socket.c
index 03d322ba00..f9da353c12 100644
--- a/src/socket.c
+++ b/src/socket.c
@@ -896,7 +896,7 @@ static void socket_enter_running(Socket *s, int cfd) {
Unit *u;
char *prefix, *instance, *name;
- if ((r = instance_from_socket(cfd, s->n_accepted++, &instance)))
+ if ((r = instance_from_socket(cfd, s->n_accepted++, &instance)) < 0)
goto fail;
if (!(prefix = unit_name_to_prefix(UNIT(s)->meta.id))) {
@@ -909,8 +909,10 @@ static void socket_enter_running(Socket *s, int cfd) {
free(prefix);
free(instance);
- if (!name)
+ if (!name) {
r = -ENOMEM;
+ goto fail;
+ }
r = manager_load_unit(UNIT(s)->meta.manager, name, NULL, &u);
free(name);
@@ -918,7 +920,7 @@ static void socket_enter_running(Socket *s, int cfd) {
if (r < 0)
goto fail;
- if ((r = service_set_socket_fd(SERVICE(u), cfd) < 0))
+ if ((r = service_set_socket_fd(SERVICE(u), cfd)) < 0)
goto fail;
cfd = -1;