[PATCH 2/2] ALSA: gus: Fix memory leaks at error paths in memory allocations

Takashi Iwai tiwai at suse.de
Mon Dec 13 15:06:42 CET 2021


On Mon, 13 Dec 2021 15:02:46 +0100,
Jaroslav Kysela wrote:
> 
> On 13. 12. 21 14:24, Takashi Iwai wrote:
> > When snd_gf1_mem_xalloc() returns NULL, the current code still leaves
> > the formerly allocated block.name string but returns an error
> > immediately.  This patch covers the all callers to deal with the
> > release of leftover name strings in the error paths.
> >
> > Signed-off-by: Takashi Iwai <tiwai at suse.de>
> 
> It may be easier to pass the name to snd_gf1_mem_xalloc() - the code flow is more readable:
(snip)

Thanks, looks like a good idea.

Since the kstrdup() NULL check fix was already applied, I'll resubmit
with the new one.


Takashi


More information about the Alsa-devel mailing list