Bug 1410191

Summary: Leak in src/polkitbackend/polkitbackendauthority.c:server_handle_register_authentication_agent_with_options()
Product: Red Hat Enterprise Linux 7 Reporter: Paulo Andrade <pandrade>
Component: polkitAssignee: Miloslav Trmač <mitr>
Status: CLOSED WONTFIX QA Contact: BaseOS QE Security Team <qe-baseos-security>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 7.2CC: cww, pkis
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-06-21 19:43:32 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Bug Depends On:    
Bug Blocks: 1420851    

Description Paulo Andrade 2017-01-04 17:37:08 UTC
Based on valgrind, there is a 40 byte leak:

==00:18:13:25.070 9577== 40 bytes in 1 blocks are definitely lost in loss record 1,263 of 2,339
==00:18:13:25.070 9577==    at 0x4C29BFD: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==00:18:13:25.070 9577==    by 0x567130D: g_malloc (in /usr/lib64/libglib-2.0.so.0.4600.2)
==00:18:13:25.070 9577==    by 0x56870FD: g_slice_alloc (in /usr/lib64/libglib-2.0.so.0.4600.2)
==00:18:13:25.070 9577==    by 0x56A5613: g_variant_get_child_value (in /usr/lib64/libglib-2.0.so.0.4600.2)
==00:18:13:25.070 9577==    by 0x56A2E6E: ??? (in /usr/lib64/libglib-2.0.so.0.4600.2)
==00:18:13:25.070 9577==    by 0x56A3E59: g_variant_get_va (in /usr/lib64/libglib-2.0.so.0.4600.2)
==00:18:13:25.070 9577==    by 0x56A4241: g_variant_get (in /usr/lib64/libglib-2.0.so.0.4600.2)
==00:18:13:25.070 9577==    by 0x112677: server_handle_register_authentication_agent_with_options (polkitbackendauthority.c:918)
==00:18:13:25.070 9577==    by 0x112677: server_handle_method_call (polkitbackendauthority.c:1222)
==00:18:13:25.070 9577==    by 0x51242F0: ??? (in /usr/lib64/libgio-2.0.so.0.4600.2)
==00:18:13:25.070 9577==    by 0x566BD79: g_main_context_dispatch (in /usr/lib64/libglib-2.0.so.0.4600.2)
==00:18:13:25.070 9577==    by 0x566C0B7: ??? (in /usr/lib64/libglib-2.0.so.0.4600.2)
==00:18:13:25.070 9577==    by 0x566C389: g_main_loop_run (in /usr/lib64/libglib-2.0.so.0.4600.2)
==00:18:13:25.070 9577==    by 0x1115F4: main (polkitd.c:236)

My first guess is that it is missing a
g_variant_unref(subject_gvariant) call.

Comment 1 Miloslav Trmač 2017-01-04 18:09:37 UTC
Yeah, at a first (unverified!) glance, this seems to be an unfixed variant of https://cgit.freedesktop.org/polkit/commit/src/polkitbackend/polkitbackendauthority.c?id=ec039f9d7ede5b839f5511e26d5cd6ae9107cb2e . 

Thanks for your report.