summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorShawn Landden <shawn@churchofgit.com>2013-11-16 13:18:12 -0800
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2013-11-17 17:41:35 -0500
commite55001ebba6f6ad7d63db249f7bf93f25be12acd (patch)
treef76ccab7de3bcbb4a614d4a54c90a48e38bed80b /src
parentf882c247ad59776c3a7753bb963c1f8e2386cb79 (diff)
core/socket: use _cleanup_free_
Diffstat (limited to 'src')
-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)