From 0a7512040ff4e9e6354d8d519cd74dfb50fb7825 Mon Sep 17 00:00:00 2001 From: rbuj Date: Thu, 21 Oct 2021 16:15:39 +0200 Subject: datetime: fix memory leak --- plugins/datetime/msd-datetime-mechanism.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'plugins/datetime') diff --git a/plugins/datetime/msd-datetime-mechanism.c b/plugins/datetime/msd-datetime-mechanism.c index 0a604f6..75a7615 100644 --- a/plugins/datetime/msd-datetime-mechanism.c +++ b/plugins/datetime/msd-datetime-mechanism.c @@ -228,7 +228,7 @@ msd_datetime_mechanism_new (void) static gboolean _check_polkit_for_action (MsdDatetimeMechanism *mechanism, DBusGMethodInvocation *context, const char *action) { - const char *sender; + char *sender; GError *error; PolkitSubject *subject; PolkitAuthorizationResult *result; @@ -238,6 +238,7 @@ _check_polkit_for_action (MsdDatetimeMechanism *mechanism, DBusGMethodInvocation /* Check that caller is privileged */ sender = dbus_g_method_get_sender (context); subject = polkit_system_bus_name_new (sender); + g_free (sender); result = polkit_authority_check_authorization_sync (mechanism->priv->auth, subject, @@ -587,7 +588,7 @@ check_can_do (MsdDatetimeMechanism *mechanism, const char *action, DBusGMethodInvocation *context) { - const char *sender; + char *sender; PolkitSubject *subject; PolkitAuthorizationResult *result; GError *error; @@ -595,6 +596,7 @@ check_can_do (MsdDatetimeMechanism *mechanism, /* Check that caller is privileged */ sender = dbus_g_method_get_sender (context); subject = polkit_system_bus_name_new (sender); + g_free (sender); error = NULL; result = polkit_authority_check_authorization_sync (mechanism->priv->auth, -- cgit v1.2.1