summaryrefslogtreecommitdiff
path: root/src/core/socket.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/socket.c')
-rw-r--r--src/core/socket.c10
1 files changed, 2 insertions, 8 deletions
diff --git a/src/core/socket.c b/src/core/socket.c
index 03b8f927bb..f505e4f969 100644
--- a/src/core/socket.c
+++ b/src/core/socket.c
@@ -1475,7 +1475,7 @@ static void socket_enter_running(Socket *s, int cfd) {
socket_set_state(s, SOCKET_RUNNING);
} else {
- char *prefix, *instance = NULL, *name;
+ _cleanup_free_ char *prefix = NULL, *instance = NULL, *name = NULL;
Service *service;
if (s->n_connections >= s->max_connections) {
@@ -1503,14 +1503,11 @@ static void socket_enter_running(Socket *s, int cfd) {
prefix = unit_name_to_prefix(UNIT(s)->id);
if (!prefix) {
- free(instance);
r = -ENOMEM;
goto fail;
}
name = unit_name_build(prefix, instance, ".service");
- free(prefix);
- free(instance);
if (!name) {
r = -ENOMEM;
@@ -1518,10 +1515,8 @@ static void socket_enter_running(Socket *s, int cfd) {
}
r = unit_add_name(UNIT_DEREF(s->service), name);
- if (r < 0) {
- free(name);
+ if (r < 0)
goto fail;
- }
service = SERVICE(UNIT_DEREF(s->service));
unit_ref_unset(&s->service);
@@ -1530,7 +1525,6 @@ static void socket_enter_running(Socket *s, int cfd) {
UNIT(service)->no_gc = false;
unit_choose_id(UNIT(service), name);
- free(name);
r = service_set_socket_fd(service, cfd, s);
if (r < 0)