Blame SOURCES/0002-resource-manager-rm-ref-count-inc-of-handle_entry.patch

d9c268
From ec7116d0e4de535a90c1dc5edabe821f04a0f8e0 Mon Sep 17 00:00:00 2001
d9c268
From: William Roberts <william.c.roberts@intel.com>
d9c268
Date: Wed, 13 Jan 2021 12:21:47 -0600
d9c268
Subject: [PATCH 2/6] resource-manager: rm ref count inc of handle_entry
d9c268
d9c268
Per:
d9c268
  - https://developer.gnome.org/gobject/stable/gobject-memory.html
d9c268
d9c268
g_object_new sets the ref count to 1, so their is no need to bump it
d9c268
again, we already have ownership.
d9c268
d9c268
Fixes leaks like:
d9c268
Direct leak of 10480 byte(s) in 2 object(s) allocated from:
d9c268
    #0 0x7f1aa88aabc8 in malloc (/usr/lib/x86_64-linux-gnu/libasan.so.5+0x10dbc8)
d9c268
    #1 0x7f1aa848acd8 in g_malloc (/usr/lib/x86_64-linux-gnu/libglib-2.0.so.0+0x57cd8)
d9c268
    #2 0x7f1aa84a32c5 in g_slice_alloc (/usr/lib/x86_64-linux-gnu/libglib-2.0.so.0+0x702c5)
d9c268
    #3 0x7f1aa84a38ed in g_slice_alloc0 (/usr/lib/x86_64-linux-gnu/libglib-2.0.so.0+0x708ed)
d9c268
    #4 0x7f1aa85970cf in g_type_create_instance (/usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0+0x3b0cf)
d9c268
    #5 0x7f1aa857634c  (/usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0+0x1a34c)
d9c268
    #6 0x7f1aa8578377 in g_object_new_valist (/usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0+0x1c377)
d9c268
    #7 0x7f1aa85786cc in g_object_new (/usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0+0x1c6cc)
d9c268
    #8 0x561e13d667d3 in handle_map_entry_new src/handle-map-entry.c:138
d9c268
    #9 0x561e13d540d3 in create_context_mapping_transient src/resource-manager.c:1160
d9c268
    #10 0x561e13d547b1 in resource_manager_create_context_mapping src/resource-manager.c:1261
d9c268
    #11 0x561e13d54ec8 in resource_manager_process_tpm2_command src/resource-manager.c:1359
d9c268
    #12 0x561e13d55365 in resource_manager_thread src/resource-manager.c:1424
d9c268
    #13 0x7f1aa8384608 in start_thread /build/glibc-ZN95T4/glibc-2.31/nptl/pthread_create.c:477
d9c268
    #14 0x7f1aa82ab292 in __clone (/lib/x86_64-linux-gnu/libc.so.6+0x122292)
d9c268
d9c268
Signed-off-by: William Roberts <william.c.roberts@intel.com>
d9c268
---
d9c268
 src/resource-manager.c | 1 -
d9c268
 1 file changed, 1 deletion(-)
d9c268
d9c268
diff --git a/src/resource-manager.c b/src/resource-manager.c
d9c268
index 904f683..050436f 100644
d9c268
--- a/src/resource-manager.c
d9c268
+++ b/src/resource-manager.c
d9c268
@@ -1167,7 +1167,6 @@ create_context_mapping_transient (ResourceManager  *resmgr,
d9c268
     handle_map_insert (handle_map, vhandle, handle_entry);
d9c268
     g_object_unref (handle_map);
d9c268
     tpm2_response_set_handle (response, vhandle);
d9c268
-    g_object_ref (handle_entry);
d9c268
 }
d9c268
 /*
d9c268
  * This function after a Tpm2Command is sent to the TPM and:
d9c268
-- 
d9c268
2.34.3
d9c268