qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] qemu-keymap: Free xkb allocations
@ 2024-05-01  7:55 Akihiko Odaki
  2024-05-05 10:24 ` Michael Tokarev
  0 siblings, 1 reply; 3+ messages in thread
From: Akihiko Odaki @ 2024-05-01  7:55 UTC (permalink / raw)
  To: Michael Tokarev, Laurent Vivier; +Cc: qemu-devel, qemu-trivial, Akihiko Odaki

This fixes LeakSanitizer complaints with xkbcommon 1.6.0.

Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
---
 qemu-keymap.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/qemu-keymap.c b/qemu-keymap.c
index 8c80f7a4ed65..7a9f38cf9863 100644
--- a/qemu-keymap.c
+++ b/qemu-keymap.c
@@ -237,6 +237,9 @@ int main(int argc, char *argv[])
     xkb_state_unref(state);
     state = NULL;
 
+    xkb_keymap_unref(map);
+    xkb_context_unref(ctx);
+
     /* add quirks */
     fprintf(outfile,
             "\n"

---
base-commit: c25df57ae8f9fe1c72eee2dab37d76d904ac382e
change-id: 20240501-xkb-258483ccc5d8

Best regards,
-- 
Akihiko Odaki <akihiko.odaki@daynix.com>



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] qemu-keymap: Free xkb allocations
  2024-05-01  7:55 [PATCH] qemu-keymap: Free xkb allocations Akihiko Odaki
@ 2024-05-05 10:24 ` Michael Tokarev
  2024-05-05 10:29   ` Akihiko Odaki
  0 siblings, 1 reply; 3+ messages in thread
From: Michael Tokarev @ 2024-05-05 10:24 UTC (permalink / raw)
  To: Akihiko Odaki, Laurent Vivier; +Cc: qemu-devel, qemu-trivial

01.05.2024 10:55, Akihiko Odaki wrote:
> This fixes LeakSanitizer complaints with xkbcommon 1.6.0.
> 
> Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
> ---
>   qemu-keymap.c | 3 +++
>   1 file changed, 3 insertions(+)
> 
> diff --git a/qemu-keymap.c b/qemu-keymap.c
> index 8c80f7a4ed65..7a9f38cf9863 100644
> --- a/qemu-keymap.c
> +++ b/qemu-keymap.c
> @@ -237,6 +237,9 @@ int main(int argc, char *argv[])
>       xkb_state_unref(state);
>       state = NULL;
>   
> +    xkb_keymap_unref(map);
> +    xkb_context_unref(ctx);
> +

I'd avoid freeing any resources in main() entirely,
since it's much cheaper to free whole process by the
kernel at exit time than to mess with each chunk of
allocated memory.  Dunno how useful it is to "fix"
these.

/mjt

>       /* add quirks */
>       fprintf(outfile,
>               "\n"
> 
> ---
> base-commit: c25df57ae8f9fe1c72eee2dab37d76d904ac382e
> change-id: 20240501-xkb-258483ccc5d8
> 
> Best regards,

-- 
GPG Key transition (from rsa2048 to rsa4096) since 2024-04-24.
New key: rsa4096/61AD3D98ECDF2C8E  9D8B E14E 3F2A 9DD7 9199  28F1 61AD 3D98 ECDF 2C8E
Old key: rsa2048/457CE0A0804465C5  6EE1 95D1 886E 8FFB 810D  4324 457C E0A0 8044 65C5
Transition statement: http://www.corpit.ru/mjt/gpg-transition-2024.txt



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] qemu-keymap: Free xkb allocations
  2024-05-05 10:24 ` Michael Tokarev
@ 2024-05-05 10:29   ` Akihiko Odaki
  0 siblings, 0 replies; 3+ messages in thread
From: Akihiko Odaki @ 2024-05-05 10:29 UTC (permalink / raw)
  To: Michael Tokarev, Laurent Vivier; +Cc: qemu-devel, qemu-trivial

On 2024/05/05 19:24, Michael Tokarev wrote:
> 01.05.2024 10:55, Akihiko Odaki wrote:
>> This fixes LeakSanitizer complaints with xkbcommon 1.6.0.
>>
>> Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
>> ---
>>   qemu-keymap.c | 3 +++
>>   1 file changed, 3 insertions(+)
>>
>> diff --git a/qemu-keymap.c b/qemu-keymap.c
>> index 8c80f7a4ed65..7a9f38cf9863 100644
>> --- a/qemu-keymap.c
>> +++ b/qemu-keymap.c
>> @@ -237,6 +237,9 @@ int main(int argc, char *argv[])
>>       xkb_state_unref(state);
>>       state = NULL;
>> +    xkb_keymap_unref(map);
>> +    xkb_context_unref(ctx);
>> +
> 
> I'd avoid freeing any resources in main() entirely,
> since it's much cheaper to free whole process by the
> kernel at exit time than to mess with each chunk of
> allocated memory.  Dunno how useful it is to "fix"
> these.
> 
> /mjt

This is purely to satisfy LeakSanitizier; the LeakSanitizer complaints 
result in a build failure with many noisy logs. I don't add Fixes: tags 
for this kind of leaks.

Regards,
Akihiko Odaki


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-05-05 10:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-05-01  7:55 [PATCH] qemu-keymap: Free xkb allocations Akihiko Odaki
2024-05-05 10:24 ` Michael Tokarev
2024-05-05 10:29   ` Akihiko Odaki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).