diff options
author | Christophe Fergeau <cfergeau@redhat.com> | 2014-09-22 13:30:44 +0200 |
---|---|---|
committer | Stef Walter <stefw@gnome.org> | 2014-10-14 17:55:45 +0200 |
commit | 0db2253d64b5607bf20e4e17060de81450e91797 (patch) | |
tree | 9056d8a1e64531280682c1abddc45d38c0c780c4 | |
parent | 37c493c086f1721d6dea77bac462e60dc23096df (diff) |
xdg: Fix ref leak in remove_assertion_from_trust()
When a transaction is used, remove_assertion_from_trust() will
steal the assertion and its key from the 'assertions' hash table.
The stolen assertion will then be added to the transaction and be
unreferenced later, but the key must be unref'ed as the hash table
owned a reference on it.
This fixes:
==9337== 104 (40 direct, 64 indirect) bytes in 1 blocks are definitely lost in loss record 614 of 678
==9337== at 0x4A0645D: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==9337== by 0x4EEADE6: g_malloc (gmem.c:97)
==9337== by 0x4F03A22: g_slice_alloc (gslice.c:1007)
==9337== by 0x4EB6954: g_bytes_new_with_free_func (gbytes.c:183)
==9337== by 0x4EB68D5: g_bytes_new_take (gbytes.c:126)
==9337== by 0x4116D4: create_assertion_key (gkm-xdg-trust.c:355)
==9337== by 0x411755: lookup_or_create_assertion_key (gkm-xdg-trust.c:371)
==9337== by 0x41312C: gkm_xdg_trust_replace_assertion (gkm-xdg-trust.c:874)
==9337== by 0x413B62: factory_create_assertion (gkm-xdg-assertion.c:181)
==9337== by 0x4338A3: gkm_session_create_object_for_factory (gkm-session.c:778)
==9337== by 0x433A5B: gkm_session_create_object_for_attributes (gkm-session.c:820)
==9337== by 0x434222: gkm_session_C_CreateObject (gkm-session.c:954)
==9337== by 0x40A1D0: test_create_assertion_twice (test-xdg-trust.c:497)
==9337== by 0x4F0E27A: test_case_run (gtestutils.c:2059)
==9337== by 0x4F0E602: g_test_run_suite_internal (gtestutils.c:2120)
==9337== by 0x4F0E6C4: g_test_run_suite_internal (gtestutils.c:2131)
==9337== by 0x4F0E6C4: g_test_run_suite_internal (gtestutils.c:2131)
==9337== by 0x4F0E847: g_test_run_suite (gtestutils.c:2184)
==9337== by 0x4F0D551: g_test_run (gtestutils.c:1488)
==9337== by 0x4516AD: testing_thread (egg-testing.c:142)
==9337== by 0x4F112F4: g_thread_proxy (gthread.c:764)
==9337== by 0x3B7AE07F34: start_thread (pthread_create.c:309)
==9337== by 0x3B7AAF4C3C: clone (clone.S:111)
https://bugzilla.gnome.org/show_bug.cgi?id=738508
-rw-r--r-- | pkcs11/xdg-store/gkm-xdg-trust.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/pkcs11/xdg-store/gkm-xdg-trust.c b/pkcs11/xdg-store/gkm-xdg-trust.c index fa5e16b5..68d97213 100644 --- a/pkcs11/xdg-store/gkm-xdg-trust.c +++ b/pkcs11/xdg-store/gkm-xdg-trust.c @@ -439,6 +439,7 @@ remove_assertion_from_trust (GkmXdgTrust *self, GkmAssertion *assertion, if (!g_hash_table_steal (self->pv->assertions, key)) g_return_if_reached (); gkm_transaction_add (transaction, self, complete_remove_assertion, assertion); + g_bytes_unref (key); } } |