summaryrefslogtreecommitdiff
path: root/src/login
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2016-10-16 18:28:30 -0400
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2016-10-16 23:35:39 -0400
commit6b430fdb7c0c2c52ea69a7d56f23d739218b13d0 (patch)
tree5ddb3975a8146fbee7c114e41a967e2abf9caa11 /src/login
parentd7604756ca5888350d5ed4ab6867baa967b24299 (diff)
tree-wide: use mfree more
Diffstat (limited to 'src/login')
-rw-r--r--src/login/logind-button.c9
-rw-r--r--src/login/logind-device.c9
-rw-r--r--src/login/logind-inhibit.c9
-rw-r--r--src/login/logind-seat.c9
-rw-r--r--src/login/logind-session.c12
5 files changed, 16 insertions, 32 deletions
diff --git a/src/login/logind-button.c b/src/login/logind-button.c
index baa6b7113c..90fb93bbaf 100644
--- a/src/login/logind-button.c
+++ b/src/login/logind-button.c
@@ -43,15 +43,12 @@ Button* button_new(Manager *m, const char *name) {
return NULL;
b->name = strdup(name);
- if (!b->name) {
- free(b);
- return NULL;
- }
+ if (!b->name)
+ return mfree(b);
if (hashmap_put(m->buttons, b->name, b) < 0) {
free(b->name);
- free(b);
- return NULL;
+ return mfree(b);
}
b->manager = m;
diff --git a/src/login/logind-device.c b/src/login/logind-device.c
index eb5edd1cd5..6537fa04bf 100644
--- a/src/login/logind-device.c
+++ b/src/login/logind-device.c
@@ -34,15 +34,12 @@ Device* device_new(Manager *m, const char *sysfs, bool master) {
return NULL;
d->sysfs = strdup(sysfs);
- if (!d->sysfs) {
- free(d);
- return NULL;
- }
+ if (!d->sysfs)
+ return mfree(d);
if (hashmap_put(m->devices, d->sysfs, d) < 0) {
free(d->sysfs);
- free(d);
- return NULL;
+ return mfree(d);
}
d->manager = m;
diff --git a/src/login/logind-inhibit.c b/src/login/logind-inhibit.c
index 6c78e0dddc..c93b24009b 100644
--- a/src/login/logind-inhibit.c
+++ b/src/login/logind-inhibit.c
@@ -45,17 +45,14 @@ Inhibitor* inhibitor_new(Manager *m, const char* id) {
return NULL;
i->state_file = strappend("/run/systemd/inhibit/", id);
- if (!i->state_file) {
- free(i);
- return NULL;
- }
+ if (!i->state_file)
+ return mfree(i);
i->id = basename(i->state_file);
if (hashmap_put(m->inhibitors, i->id, i) < 0) {
free(i->state_file);
- free(i);
- return NULL;
+ return mfree(i);
}
i->manager = m;
diff --git a/src/login/logind-seat.c b/src/login/logind-seat.c
index b5192320e4..ecc7bd2e5b 100644
--- a/src/login/logind-seat.c
+++ b/src/login/logind-seat.c
@@ -48,18 +48,15 @@ Seat *seat_new(Manager *m, const char *id) {
return NULL;
s->state_file = strappend("/run/systemd/seats/", id);
- if (!s->state_file) {
- free(s);
- return NULL;
- }
+ if (!s->state_file)
+ return mfree(s);
s->id = basename(s->state_file);
s->manager = m;
if (hashmap_put(m->seats, s->id, s) < 0) {
free(s->state_file);
- free(s);
- return NULL;
+ return mfree(s);
}
return s;
diff --git a/src/login/logind-session.c b/src/login/logind-session.c
index ba1bcc2630..cbf035f706 100644
--- a/src/login/logind-session.c
+++ b/src/login/logind-session.c
@@ -62,16 +62,13 @@ Session* session_new(Manager *m, const char *id) {
return NULL;
s->state_file = strappend("/run/systemd/sessions/", id);
- if (!s->state_file) {
- free(s);
- return NULL;
- }
+ if (!s->state_file)
+ return mfree(s);
s->devices = hashmap_new(&devt_hash_ops);
if (!s->devices) {
free(s->state_file);
- free(s);
- return NULL;
+ return mfree(s);
}
s->id = basename(s->state_file);
@@ -79,8 +76,7 @@ Session* session_new(Manager *m, const char *id) {
if (hashmap_put(m->sessions, s->id, s) < 0) {
hashmap_free(s->devices);
free(s->state_file);
- free(s);
- return NULL;
+ return mfree(s);
}
s->manager = m;