sound/oss/i810_audio.c: check kmalloc() return value.
PATCH 1/1 sound/oss/i810_audio.c: check kmalloc() return value.
Description: Check the return value of kmalloc() in function i810_open(), in file sound/oss/i810_audio.c.
Signed-off-by Amit Choudhary <[email protected]>
sound/oss/i810_audio.c +6 -1
@@ -2580,8 +2580,13 @@ static int i810_open(struct inode *inodeif (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;