summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2012-11-22 00:40:45 +0100
committerLennart Poettering <lennart@poettering.net>2012-11-22 00:45:22 +0100
commite42e801b55740df1e2007336c8e2cb1e538849e1 (patch)
treeea2e610f7fe84e1557a7e042601e796a8b3363c3
parent68b29a9fca915c83b9192790ec61189430cd5de6 (diff)
dbus: introduce _cleanup_dbus_error_free_
-rw-r--r--src/core/automount.c8
-rw-r--r--src/shared/dbus-common.h1
2 files changed, 4 insertions, 5 deletions
diff --git a/src/core/automount.c b/src/core/automount.c
index 5b1f544f08..5bf59df8bc 100644
--- a/src/core/automount.c
+++ b/src/core/automount.c
@@ -40,6 +40,7 @@
#include "label.h"
#include "mkdir.h"
#include "path-util.h"
+#include "dbus-common.h"
static const UnitActiveState state_translation_table[_AUTOMOUNT_STATE_MAX] = {
[AUTOMOUNT_DEAD] = UNIT_INACTIVE,
@@ -585,7 +586,7 @@ fail:
static void automount_enter_runnning(Automount *a) {
int r;
struct stat st;
- DBusError error;
+ _cleanup_dbus_error_free_ DBusError error;
assert(a);
assert(UNIT_DEREF(a->mount));
@@ -620,7 +621,6 @@ static void automount_enter_runnning(Automount *a) {
fail:
automount_enter_dead(a, AUTOMOUNT_FAILURE_RESOURCES);
- dbus_error_free(&error);
}
static int automount_start(Unit *u) {
@@ -791,13 +791,11 @@ static void automount_fd_event(Unit *u, int fd, uint32_t events, Watch *w) {
case autofs_ptype_missing_direct:
if (packet.v5_packet.pid > 0) {
- char *p = NULL;
+ _cleanup_free_ char *p = NULL;
get_process_comm(packet.v5_packet.pid, &p);
log_debug("Got direct mount request on %s, triggered by %lu (%s)",
a->where, (unsigned long) packet.v5_packet.pid, strna(p));
- free(p);
-
} else
log_debug("Got direct mount request on %s", a->where);
diff --git a/src/shared/dbus-common.h b/src/shared/dbus-common.h
index 3b7ae16934..a9a4dcca6b 100644
--- a/src/shared/dbus-common.h
+++ b/src/shared/dbus-common.h
@@ -224,3 +224,4 @@ const char *bus_message_get_sender_with_fallback(DBusMessage *m);
void bus_message_unrefp(DBusMessage **reply);
#define _cleanup_dbus_message_unref_ __attribute__((cleanup(bus_message_unrefp)))
+#define _cleanup_dbus_error_free_ __attribute__((cleanup(dbus_error_free)))