PolicyKit: Branch 'master'

Colin Walters walters at kemper.freedesktop.org
Mon Apr 15 05:17:55 PDT 2013


 src/polkitbackend/polkitbackendactionpool.c        |    2 +-
 src/polkitbackend/polkitbackendjsauthority.c       |    3 ++-
 test/mocklibc/src/netgroup.c                       |    5 ++++-
 test/polkitbackend/test-polkitbackendjsauthority.c |    2 ++
 4 files changed, 9 insertions(+), 3 deletions(-)

New commits:
commit 63ee649bd14c5dfa7985840061097bbac01ab721
Author: Miloslav Trmač <mitr at redhat.com>
Date:   Sat Apr 13 03:19:17 2013 +0200

    Fix various memory leaks.
    
    The XML_ParserCreate_MM one was found by Florian Weimer in
    https://bugzilla.redhat.com/show_bug.cgi?id=888728 .
    
    This should cover everything found by valgrind on the JS authority
    test, augmented with a call to
    polkit_backend_authority_enumerate_actions() to verify the
    XML_ParserCreate_MM case.
    
    https://bugs.freedesktop.org/show_bug.cgi?id=63492

diff --git a/src/polkitbackend/polkitbackendactionpool.c b/src/polkitbackend/polkitbackendactionpool.c
index 0af0010..bc14381 100644
--- a/src/polkitbackend/polkitbackendactionpool.c
+++ b/src/polkitbackend/polkitbackendactionpool.c
@@ -1051,7 +1051,6 @@ process_policy_file (PolkitBackendActionPool *pool,
 
   pd.pool = pool;
 
-  pd.parser = XML_ParserCreate_MM (NULL, NULL, NULL);
   pd.parser = XML_ParserCreate (NULL);
   pd.stack_depth = 0;
   XML_SetUserData (pd.parser, &pd);
@@ -1084,6 +1083,7 @@ process_policy_file (PolkitBackendActionPool *pool,
 
   XML_ParserFree (pd.parser);
 
+  pd_unref_data (&pd);
   return TRUE;
 
 error:
diff --git a/src/polkitbackend/polkitbackendjsauthority.c b/src/polkitbackend/polkitbackendjsauthority.c
index f66f436..6abea0a 100644
--- a/src/polkitbackend/polkitbackendjsauthority.c
+++ b/src/polkitbackend/polkitbackendjsauthority.c
@@ -507,6 +507,7 @@ setup_file_monitors (PolkitBackendJsAuthority *authority)
                                           G_FILE_MONITOR_NONE,
                                           NULL,
                                           &error);
+      g_object_unref (file);
       if (monitor == NULL)
         {
           g_warning ("Error monitoring directory %s: %s",
@@ -995,7 +996,7 @@ action_and_details_to_jsval (PolkitBackendJsAuthority  *authority,
       set_property_str (authority, obj, key, value);
       g_free (key);
     }
-  g_free (keys);
+  g_strfreev (keys);
 
   ret = TRUE;
 
diff --git a/test/mocklibc/src/netgroup.c b/test/mocklibc/src/netgroup.c
index f2ee857..bc99555 100644
--- a/test/mocklibc/src/netgroup.c
+++ b/test/mocklibc/src/netgroup.c
@@ -122,7 +122,10 @@ struct netgroup *netgroup_parse_all() {
     char * line = NULL;
     ssize_t line_size = getline(&line, &line_alloc, stream);
     if (line_size == -1)
-      break;
+      {
+	free(line);
+	break;
+      }
 
     struct netgroup *nextgroup = netgroup_parse_line(line);
     free(line);
diff --git a/test/polkitbackend/test-polkitbackendjsauthority.c b/test/polkitbackend/test-polkitbackendjsauthority.c
index cc7b15f..a4de6b1 100644
--- a/test/polkitbackend/test-polkitbackendjsauthority.c
+++ b/test/polkitbackend/test-polkitbackendjsauthority.c
@@ -104,6 +104,7 @@ test_get_admin_identities_for_action_id (const gchar         *action_id,
   g_assert (expected_admins[n] == NULL);
 
   g_list_free_full (admin_identities, g_object_unref);
+  g_clear_object (&details);
   g_clear_object (&user_for_subject);
   g_clear_object (&subject);
   g_clear_object (&caller);
@@ -374,6 +375,7 @@ rules_test_func (gconstpointer user_data)
                                                                           POLKIT_IMPLICIT_AUTHORIZATION_UNKNOWN);
   g_assert_cmpint (result, ==, tc->expected_result);
 
+  g_clear_object (&details);
   g_clear_object (&user_for_subject);
   g_clear_object (&subject);
   g_clear_object (&caller);


More information about the hal-commit mailing list