summaryrefslogtreecommitdiffstats
path: root/lib/Utils/Polkit.cpp
diff options
context:
space:
mode:
authorKarel Klic <kklic@redhat.com>2010-01-18 13:19:54 +0100
committerKarel Klic <kklic@redhat.com>2010-01-18 13:19:54 +0100
commit4267cbcc29781ddcac00e259dfe05f3a26fbc2ec (patch)
tree213e47138967f1e7af4ee9ff9a3f2ed861cb5815 /lib/Utils/Polkit.cpp
parentb2d1bd9e4f387c5a014d3002d741f25421c37aac (diff)
parentb41833ed61f7b579d2a46b26d261616c21a6ae32 (diff)
downloadabrt-4267cbcc29781ddcac00e259dfe05f3a26fbc2ec.tar.gz
abrt-4267cbcc29781ddcac00e259dfe05f3a26fbc2ec.tar.xz
abrt-4267cbcc29781ddcac00e259dfe05f3a26fbc2ec.zip
Merge branch 'master' of git://git.fedorahosted.org/git/abrt
Diffstat (limited to 'lib/Utils/Polkit.cpp')
-rw-r--r--lib/Utils/Polkit.cpp14
1 files changed, 10 insertions, 4 deletions
diff --git a/lib/Utils/Polkit.cpp b/lib/Utils/Polkit.cpp
index c868e1a..a7e4a5d 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,
+ guint cancel_timeout = g_timeout_add(POLKIT_TIMEOUT * 1000,
(GSourceFunc) do_cancel,
cancellable);
-
result = polkit_authority_check_authorization_sync(authority,
subject,
action_id,
@@ -61,7 +59,8 @@ static PolkitResult do_check(PolkitSubject *subject, const char *action_id)
POLKIT_CHECK_AUTHORIZATION_FLAGS_ALLOW_USER_INTERACTION,
cancellable,
&error);
-
+ g_object_unref(authority);
+ g_source_remove(cancel_timeout);
if (error)
{
g_error_free(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;
}