On 11/05/2025 08:38, Volker Rümelin wrote:

There is no need to allocate initialized memory with g_malloc0()
if it's directly followed by a memset() function call. g_malloc()
is sufficient.

Signed-off-by: Volker Rümelin <vr_q...@t-online.de>
---
  hw/audio/asc.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/audio/asc.c b/hw/audio/asc.c
index 03dee0fcc7..f12268e296 100644
--- a/hw/audio/asc.c
+++ b/hw/audio/asc.c
@@ -664,7 +664,7 @@ static void asc_realize(DeviceState *dev, Error **errp)
      s->samples = AUD_get_buffer_size_out(s->voice) >> s->shift;
      s->mixbuf = g_malloc0(s->samples << s->shift);
- s->silentbuf = g_malloc0(s->samples << s->shift);
+    s->silentbuf = g_malloc(s->samples << s->shift);
      memset(s->silentbuf, 0x80, s->samples << s->shift);
/* Add easc registers if required */

Reviewed-by: Mark Cave-Ayland <mark.cave-ayl...@ilande.co.uk>


ATB,

Mark.


Reply via email to