* [PATCH] sound/oss/i810_audio.c: check kmalloc() return value.
@ 2007-03-09 7:21 Amit Choudhary
0 siblings, 0 replies; only message in thread
From: Amit Choudhary @ 2007-03-09 7:21 UTC (permalink / raw)
To: Linux Kernel
Description: Check the return value of kmalloc() in function i810_open(), in file sound/oss/i810_audio.c.
Signed-off-by: Amit Choudhary <amit2030@gmail.com>
diff --git a/sound/oss/i810_audio.c b/sound/oss/i810_audio.c
index 240cc79..a415967 100644
--- a/sound/oss/i810_audio.c
+++ b/sound/oss/i810_audio.c
@@ -2580,8 +2580,13 @@ static int i810_open(struct inode *inode
if (card->states[i] == NULL) {
state = card->states[i] = (struct i810_state *)
kmalloc(sizeof(struct i810_state), GFP_KERNEL);
- if (state == NULL)
+ if (state == NULL) {
+ for (--i; i >= 0; i--) {
+ kfree(card->states[i]);
+ card->states[i] = NULL;
+ }
return -ENOMEM;
+ }
memset(state, 0, sizeof(struct i810_state));
dmabuf = &state->dmabuf;
goto found_virt;
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2007-03-09 7:22 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-03-09 7:21 [PATCH] sound/oss/i810_audio.c: check kmalloc() return value Amit Choudhary
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.