All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] disas: converts malloc to g_malloc0
@ 2026-06-30  0:52 Christian S. Lima
  2026-06-30  4:55 ` Markus Armbruster
  0 siblings, 1 reply; 5+ messages in thread
From: Christian S. Lima @ 2026-06-30  0:52 UTC (permalink / raw)
  To: qemu-devel, Laurent Vivier

Following the qemu coding style change malloc to g_malloc, the
advantages are that g_malloc will exit if some failure occur and
initialize all memory with zeros.

Signed-off-by: Christian S. Lima <christianslima@proton.me>
---
 disas/m68k.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/disas/m68k.c b/disas/m68k.c
index 800b4145ac..e629f3c365 100644
--- a/disas/m68k.c
+++ b/disas/m68k.c
@@ -1887,8 +1887,8 @@ print_insn_m68k (bfd_vma memaddr, disassemble_info *info)
 
       /* Then create a sorted table of pointers
 	 that point into the unsorted table.  */
-      opc_pointer[0] = malloc (sizeof (struct m68k_opcode *)
-                               * m68k_numopcodes);
+      opc_pointer[0] = g_malloc0 (sizeof (struct m68k_opcode)
+                                  * m68k_numopcodes);
       opcodes[0] = opc_pointer[0];
 
       for (i = 1; i < 16; i++)
-- 
2.53.0




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

end of thread, other threads:[~2026-06-30 21:42 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-30  0:52 [PATCH] disas: converts malloc to g_malloc0 Christian S. Lima
2026-06-30  4:55 ` Markus Armbruster
2026-06-30  6:02   ` Christian
2026-06-30  6:53     ` Markus Armbruster
2026-06-30 21:41       ` Christian

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.