|
From: | Philippe Mathieu-Daudé |
Subject: | Re: [PATCH 07/11] audio/audio_template: use g_malloc0() to replace audio_calloc() |
Date: | Sun, 18 Dec 2022 21:34:21 +0100 |
User-agent: | Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.5.1 |
On 18/12/22 21:05, Christian Schoenebeck wrote:
On Sunday, December 18, 2022 6:39:00 PM CET Volker Rümelin wrote:Am 18.12.22 um 18:26 schrieb Philippe Mathieu-Daudé:On 18/12/22 18:15, Volker Rümelin wrote:Use g_malloc0() as a direct replacement for audio_calloc(). Signed-off-by: Volker Rümelin <vr_qemu@t-online.de> --- audio/audio_template.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/audio/audio_template.h b/audio/audio_template.h index d343a1dcb3..5f51ef26b2 100644 --- a/audio/audio_template.h +++ b/audio/audio_template.h @@ -273,7 +273,7 @@ static HW *glue(audio_pcm_hw_add_new_, TYPE)(AudioState *s, return NULL; } - hw = audio_calloc(__func__, 1, glue(drv->voice_size_, TYPE)); + hw = g_malloc0(glue(drv->voice_size_, TYPE)); if (!hw) {g_malloc0() can't fail. Either you want g_try_malloc0() or remove the error path.g_malloc0() returns NULL if drv->voice_size_(out|in) is 0. I think the code is correct.Correct, that's the only case these glib functions return NULL. And AFAICS this can be zero with CoreAudio or wav.
Oh I forgot the '0' case, my bad. Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
[Prev in Thread] | Current Thread | [Next in Thread] |