summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2013-08-24 23:48:34 -0400
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2013-08-28 08:04:56 -0400
commit5af726cced7f87d6f7b7d6bd1dd5ee44ded5aa7b (patch)
tree11e79c010bba9f324ea309e7b4fd00b94f124317 /src
parent042f598892e2587d735e4de1f4aabcb3d89d05f1 (diff)
logind-session.c: use _cleanup_
Diffstat (limited to 'src')
-rw-r--r--src/login/logind-session.c17
1 files changed, 4 insertions, 13 deletions
diff --git a/src/login/logind-session.c b/src/login/logind-session.c
index dac50e8334..a726fb1bed 100644
--- a/src/login/logind-session.c
+++ b/src/login/logind-session.c
@@ -381,7 +381,8 @@ int session_activate(Session *s) {
}
static int session_link_x11_socket(Session *s) {
- char *t, *f, *c;
+ _cleanup_free_ char *t = NULL, *f = NULL;
+ char *c;
size_t k;
assert(s);
@@ -405,7 +406,6 @@ static int session_link_x11_socket(Session *s) {
if (access(f, F_OK) < 0) {
log_warning("Session %s has display %s with non-existing socket %s.", s->id, s->display, f);
- free(f);
return -ENOENT;
}
@@ -414,10 +414,8 @@ static int session_link_x11_socket(Session *s) {
* path is owned by the user */
t = strappend(s->user->runtime_path, "/X11-display");
- if (!t) {
- free(f);
+ if (!t)
return log_oom();
- }
if (link(f, t) < 0) {
if (errno == EEXIST) {
@@ -437,17 +435,12 @@ static int session_link_x11_socket(Session *s) {
}
log_error("Failed to link %s to %s: %m", f, t);
- free(f);
- free(t);
return -errno;
}
}
done:
log_info("Linked %s to %s.", f, t);
- free(f);
- free(t);
-
s->user->display = s;
return 0;
@@ -585,7 +578,7 @@ static int session_stop_scope(Session *s) {
}
static int session_unlink_x11_socket(Session *s) {
- char *t;
+ _cleanup_free_ char *t = NULL;
int r;
assert(s);
@@ -601,8 +594,6 @@ static int session_unlink_x11_socket(Session *s) {
return log_oom();
r = unlink(t);
- free(t);
-
return r < 0 ? -errno : 0;
}