Browse Source

soc: Add proper null check for client array pointer

Check if snd event client array is null before
dereferencing.

CRs-Fixed: 2328286
Change-Id: I4f7c2a1288ee27df51609e090cb2da2d33624a07
Signed-off-by: Tanya Dixit <[email protected]>
Tanya Dixit 6 years ago
parent
commit
d7a6390344
1 changed files with 4 additions and 0 deletions
  1. 4 0
      soc/snd_event.c

+ 4 - 0
soc/snd_event.c

@@ -301,6 +301,10 @@ void snd_event_mstr_add_client(struct snd_event_clients **snd_clients,
 		}
 		client->cl_arr = kzalloc(sizeof(struct snd_event_client_array),
 					 GFP_KERNEL);
+		if (!client->cl_arr) {
+			*snd_clients = ERR_PTR(-ENOMEM);
+			return;
+		}
 		*snd_clients = client;
 	} else {
 		struct snd_event_client_array *new;