HomeClusterLabs Projects

Fix: libservices: use DBusError API properly

Description

Fix: libservices: use DBusError API properly

Before, we set error.name and error.message directly in most cases.
Now, we use dbus_set_error_const(). This is effectively the same, but it is
the proper usage of the API, at the cost of slightly more overhead due to
the function call and some checking.

Also, we now use dbus_error_free() consistently for all DBusError objects.

The combination of these changes gives us more reliable memory management,
including fixing one memory leak: pcmk_dbus_find_error() directly assigned name
and message in most cases, but used dbus_set_error_from_message() in one case,
which allocates the name and message and would leak.

Details

Provenance
kgaillotAuthored on Sep 7 2016, 6:49 PM
Parents
rP26ba3fa36cf0: Refactor: libservices: functionize sending a simple systemd method
Branches
Unknown
Tags
Unknown

Event Timeline