summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPanu Matilainen <pmatilai@redhat.com>2020-01-29 15:39:58 +0200
committerPanu Matilainen <pmatilai@redhat.com>2020-03-26 11:57:58 +0200
commitbf2404de5e34dec80d78b3955c00798dc93d9e8b (patch)
treeb5f95b99f6ce413c19f20dc6da151c73b8b7c312
parentf5e8cd83042834fe09738a7986a071692f99628e (diff)
downloadrpm-bf2404de5e34dec80d78b3955c00798dc93d9e8b.tar.gz
Fix a minor memory leak on suppressed inhibition lock warning message
Commit 708e61307bc3fd027b016fdf5a1d1a5274c1843c introduced a memory leak on the error object: if the message is suppressed then the error object is never freed. Test for the suppression conditions separately to fix. (cherry picked from commit 4ddab4fb7e1ccc7dc466534250177b7d2682a9e2)
-rw-r--r--plugins/systemd_inhibit.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/plugins/systemd_inhibit.c b/plugins/systemd_inhibit.c
index 0ddca9cd8..ecff30533 100644
--- a/plugins/systemd_inhibit.c
+++ b/plugins/systemd_inhibit.c
@@ -52,12 +52,14 @@ static int inhibit(void)
dbus_message_unref(reply);
}
- if (dbus_error_is_set(&err)
- && !dbus_error_has_name(&err, DBUS_ERROR_NO_SERVER)
- && !dbus_error_has_name(&err, DBUS_ERROR_FILE_NOT_FOUND)) {
- rpmlog(RPMLOG_WARNING,
+ if (dbus_error_is_set(&err)) {
+ if (!dbus_error_has_name(&err, DBUS_ERROR_NO_SERVER) &&
+ !dbus_error_has_name(&err, DBUS_ERROR_FILE_NOT_FOUND))
+ {
+ rpmlog(RPMLOG_WARNING,
"Unable to get systemd shutdown inhibition lock: %s\n",
err.message);
+ }
dbus_error_free(&err);
}