[gnome-keyring] xdg: Remove wrong unref in gkm_xdg_trust_replace_assertion



commit 37c493c086f1721d6dea77bac462e60dc23096df
Author: Christophe Fergeau <cfergeau redhat com>
Date:   Mon Sep 22 11:54:55 2014 +0200

    xdg: Remove wrong unref in gkm_xdg_trust_replace_assertion
    
    Callers of lookup_or_create_assertion_key() don't own a reference
    on the returned GBytes so it should not be unref'fed before exiting
    gkm_xdg_trust_replace_assertion.
    This solves the following errors from valgrind when running test-xdg-trust
    
    ==15477==
    ==15477== Thread 2 testing:
    ==15477== Invalid read of size 4
    ==15477==    at 0x4EB6B75: g_bytes_unref (gbytes.c:306)
    ==15477==    by 0x4EC2692: g_datalist_clear (gdataset.c:273)
    ==15477==    by 0x4C284A3: g_object_finalize (gobject.c:1033)
    ==15477==    by 0x42B35E: gkm_object_finalize (gkm-object.c:448)
    ==15477==    by 0x414134: gkm_assertion_finalize (gkm-assertion.c:134)
    ==15477==    by 0x4C2D256: g_object_unref (gobject.c:3170)
    ==15477==    by 0x43B9C7: gkm_util_dispose_unref (gkm-util.c:137)
    ==15477==    by 0x4ECEBD1: g_hash_table_remove_all_nodes (ghash.c:503)
    ==15477==    by 0x4ECFC02: g_hash_table_remove_all (ghash.c:1371)
    ==15477==    by 0x431DBB: gkm_session_dispose (gkm-session.c:409)
    ==15477==    by 0x4C2D131: g_object_unref (gobject.c:3133)
    ==15477==    by 0x425391: apartment_free (gkm-module.c:241)
    ==15477==    by 0x4ECEBD1: g_hash_table_remove_all_nodes (ghash.c:503)
    ==15477==    by 0x4ECFC02: g_hash_table_remove_all (ghash.c:1371)
    ==15477==    by 0x4267F9: gkm_module_dispose (gkm-module.c:633)
    ==15477==    by 0x4107D3: gkm_xdg_module_dispose (gkm-xdg-module.c:553)
    ==15477==    by 0x4C28648: g_object_run_dispose (gobject.c:1076)
    ==15477==    by 0x40CCDD: gkm_C_Finalize (gkm-module-ep.h:102)
    ==15477==    by 0x40C7F0: mock_xdg_module_leave_and_finalize (mock-xdg-module.c:151)
    ==15477==    by 0x408585: teardown (test-xdg-trust.c:138)
    ==15477==    by 0x4F0E2FE: test_case_run (gtestutils.c:2069)
    ==15477==    by 0x4F0E602: g_test_run_suite_internal (gtestutils.c:2120)
    ==15477==    by 0x4F0E6C4: g_test_run_suite_internal (gtestutils.c:2131)
    ==15477==    by 0x4F0E6C4: g_test_run_suite_internal (gtestutils.c:2131)
    ==15477==    by 0x4F0E847: g_test_run_suite (gtestutils.c:2184)
    ==15477==    by 0x4F0D551: g_test_run (gtestutils.c:1488)
    ==15477==    by 0x4516B9: testing_thread (egg-testing.c:142)
    ==15477==    by 0x4F112F4: g_thread_proxy (gthread.c:764)
    ==15477==    by 0x3B7AE07F34: start_thread (pthread_create.c:309)
    ==15477==    by 0x3B7AAF4C3C: clone (clone.S:111)
    ==15477==  Address 0x52b6100 is 16 bytes inside a block of size 40 free'd
    ==15477==    at 0x4A07577: free (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
    ==15477==    by 0x4EEAF5F: g_free (gmem.c:190)
    ==15477==    by 0x4F03C59: g_slice_free1 (gslice.c:1112)
    ==15477==    by 0x4EB6BB8: g_bytes_unref (gbytes.c:310)
    ==15477==    by 0x4ECEBB3: g_hash_table_remove_all_nodes (ghash.c:500)
    ==15477==    by 0x4ECFC02: g_hash_table_remove_all (ghash.c:1371)
    ==15477==    by 0x4ECF7C4: g_hash_table_destroy (ghash.c:1067)
    ==15477==    by 0x4127E9: gkm_xdg_trust_finalize (gkm-xdg-trust.c:706)
    ==15477==    by 0x4C2D256: g_object_unref (gobject.c:3170)
    ==15477==    by 0x43B9C7: gkm_util_dispose_unref (gkm-util.c:137)
    ==15477==    by 0x4ECEBD1: g_hash_table_remove_all_nodes (ghash.c:503)
    ==15477==    by 0x4ECFC02: g_hash_table_remove_all (ghash.c:1371)
    ==15477==    by 0x431DBB: gkm_session_dispose (gkm-session.c:409)
    ==15477==    by 0x4C2D131: g_object_unref (gobject.c:3133)
    ==15477==    by 0x425391: apartment_free (gkm-module.c:241)
    ==15477==    by 0x4ECEBD1: g_hash_table_remove_all_nodes (ghash.c:503)
    ==15477==    by 0x4ECFC02: g_hash_table_remove_all (ghash.c:1371)
    ==15477==    by 0x4267F9: gkm_module_dispose (gkm-module.c:633)
    ==15477==    by 0x4107D3: gkm_xdg_module_dispose (gkm-xdg-module.c:553)
    ==15477==    by 0x4C28648: g_object_run_dispose (gobject.c:1076)
    ==15477==    by 0x40CCDD: gkm_C_Finalize (gkm-module-ep.h:102)
    ==15477==    by 0x40C7F0: mock_xdg_module_leave_and_finalize (mock-xdg-module.c:151)
    ==15477==    by 0x408585: teardown (test-xdg-trust.c:138)
    ==15477==    by 0x4F0E2FE: test_case_run (gtestutils.c:2069)
    ==15477==    by 0x4F0E602: g_test_run_suite_internal (gtestutils.c:2120)
    ==15477==    by 0x4F0E6C4: g_test_run_suite_internal (gtestutils.c:2131)
    ==15477==    by 0x4F0E6C4: g_test_run_suite_internal (gtestutils.c:2131)
    ==15477==    by 0x4F0E847: g_test_run_suite (gtestutils.c:2184)
    ==15477==    by 0x4F0D551: g_test_run (gtestutils.c:1488)
    ==15477==    by 0x4516B9: testing_thread (egg-testing.c:142)
    ==15477==    by 0x4F112F4: g_thread_proxy (gthread.c:764)
    ==15477==    by 0x3B7AE07F34: start_thread (pthread_create.c:309)
    ==15477==    by 0x3B7AAF4C3C: clone (clone.S:111)
    
    https://bugzilla.gnome.org/show_bug.cgi?id=738508

 pkcs11/xdg-store/gkm-xdg-trust.c |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)
---
diff --git a/pkcs11/xdg-store/gkm-xdg-trust.c b/pkcs11/xdg-store/gkm-xdg-trust.c
index be0f4d4..fa5e16b 100644
--- a/pkcs11/xdg-store/gkm-xdg-trust.c
+++ b/pkcs11/xdg-store/gkm-xdg-trust.c
@@ -879,7 +879,6 @@ gkm_xdg_trust_replace_assertion (GkmXdgTrust *self, GkmAssertion *assertion,
                remove_assertion_from_trust (self, previous, transaction);
        add_assertion_to_trust (self, assertion, transaction);
 
-       g_bytes_unref (key);
 }
 
 void


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]