summaryrefslogtreecommitdiffstats
path: root/lib/Utils/Polkit.cpp
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2010-01-11 07:22:13 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2010-01-11 07:22:13 +0100
commit14ef0cfe72faf6696df3ef8f42927e9458ccbeeb (patch)
treec5d3a3169fc31f212d507553beb67920be92ebcd /lib/Utils/Polkit.cpp
parentb1c4304104910c4bc066cd43f9784fe2f3ddf1ad (diff)
downloadabrt-14ef0cfe72faf6696df3ef8f42927e9458ccbeeb.tar.gz
abrt-14ef0cfe72faf6696df3ef8f42927e9458ccbeeb.tar.xz
abrt-14ef0cfe72faf6696df3ef8f42927e9458ccbeeb.zip
*: misc fixes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'lib/Utils/Polkit.cpp')
-rw-r--r--lib/Utils/Polkit.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/Utils/Polkit.cpp b/lib/Utils/Polkit.cpp
index c868e1a..8bd0eb6 100644
--- a/lib/Utils/Polkit.cpp
+++ b/lib/Utils/Polkit.cpp
@@ -46,14 +46,12 @@ static PolkitResult do_check(PolkitSubject *subject, const char *action_id)
GCancellable * cancellable;
authority = polkit_authority_get();
-
cancellable = g_cancellable_new();
g_timeout_add(POLKIT_TIMEOUT * 1000,
(GSourceFunc) do_cancel,
cancellable);
-
result = polkit_authority_check_authorization_sync(authority,
subject,
action_id,
@@ -61,6 +59,7 @@ static PolkitResult do_check(PolkitSubject *subject, const char *action_id)
POLKIT_CHECK_AUTHORIZATION_FLAGS_ALLOW_USER_INTERACTION,
cancellable,
&error);
+ g_object_unref(authority);
if (error)
{
@@ -71,11 +70,18 @@ static PolkitResult do_check(PolkitSubject *subject, const char *action_id)
if (result)
{
if (polkit_authorization_result_get_is_challenge(result))
+ {
/* Can't happen (happens only with
* POLKIT_CHECK_AUTHORIZATION_FLAGS_NONE flag) */
+ g_object_unref(result);
return PolkitChallenge;
+ }
if (polkit_authorization_result_get_is_authorized(result))
+ {
+ g_object_unref(result);
return PolkitYes;
+ }
+ g_object_unref(result);
return PolkitNo;
}