All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] ALSA: gus: Fix erroneous memory allocation
@ 2021-12-13 13:24 Takashi Iwai
  2021-12-13 13:24 ` [PATCH 2/2] ALSA: gus: Fix memory leaks at error paths in memory allocations Takashi Iwai
  2021-12-13 13:57 ` [PATCH 1/2] ALSA: gus: Fix erroneous memory allocation Jaroslav Kysela
  0 siblings, 2 replies; 5+ messages in thread
From: Takashi Iwai @ 2021-12-13 13:24 UTC (permalink / raw)
  To: alsa-devel; +Cc: Xiaoke Wang

snd_gf1_mem_xalloc() returns NULL incorrectly when the memory chunk is
allocated in the middle of the chain.  This patch corrects the return
value to treat it properly.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
 sound/isa/gus/gus_mem.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/isa/gus/gus_mem.c b/sound/isa/gus/gus_mem.c
index 4c691dbf2721..5e3ff3137dd7 100644
--- a/sound/isa/gus/gus_mem.c
+++ b/sound/isa/gus/gus_mem.c
@@ -44,7 +44,7 @@ static struct snd_gf1_mem_block *snd_gf1_mem_xalloc(struct snd_gf1_mem * alloc,
 			else
 				nblock->prev->next = nblock;
 			mutex_unlock(&alloc->memory_mutex);
-			return NULL;
+			return nblock;
 		}
 		pblock = pblock->next;
 	}
-- 
2.31.1


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

end of thread, other threads:[~2021-12-13 14:07 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-12-13 13:24 [PATCH 1/2] ALSA: gus: Fix erroneous memory allocation Takashi Iwai
2021-12-13 13:24 ` [PATCH 2/2] ALSA: gus: Fix memory leaks at error paths in memory allocations Takashi Iwai
2021-12-13 14:02   ` Jaroslav Kysela
2021-12-13 14:06     ` Takashi Iwai
2021-12-13 13:57 ` [PATCH 1/2] ALSA: gus: Fix erroneous memory allocation Jaroslav Kysela

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.