summaryrefslogtreecommitdiff
path: root/src/login/logind-dbus.c
diff options
context:
space:
mode:
authorDavid Herrmann <dh.herrmann@gmail.com>2015-07-31 19:56:38 +0200
committerDavid Herrmann <dh.herrmann@gmail.com>2015-07-31 19:56:38 +0200
commit97b11eedff9d2e17101ad453caf9e48b73246719 (patch)
treeadd86c36a039f2cbeb8232908c7a0cb3ca784ea5 /src/login/logind-dbus.c
parentb2a0ac5e5b29c73ca7c0da23369a4769d5a91ddd (diff)
tree-wide: introduce mfree()
Pretty trivial helper which wraps free() but returns NULL, so we can simplify this: free(foobar); foobar = NULL; to this: foobar = mfree(foobar);
Diffstat (limited to 'src/login/logind-dbus.c')
-rw-r--r--src/login/logind-dbus.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/src/login/logind-dbus.c b/src/login/logind-dbus.c
index 397952e7e5..b0cd85e985 100644
--- a/src/login/logind-dbus.c
+++ b/src/login/logind-dbus.c
@@ -725,15 +725,13 @@ static int method_create_session(sd_bus_message *message, void *userdata, sd_bus
log_warning("Existing logind session ID %s used by new audit session, ignoring", id);
audit_id = 0;
- free(id);
- id = NULL;
+ id = mfree(id);
}
}
if (!id) {
do {
- free(id);
- id = NULL;
+ id = mfree(id);
if (asprintf(&id, "c%lu", ++m->session_counter) < 0)
return -ENOMEM;
@@ -2355,8 +2353,7 @@ static int method_inhibit(sd_bus_message *message, void *userdata, sd_bus_error
return r;
do {
- free(id);
- id = NULL;
+ id = mfree(id);
if (asprintf(&id, "%lu", ++m->inhibit_counter) < 0)
return -ENOMEM;