mirror of
https://github.com/openharmony/third_party_tinyalsa.git
synced 2026-07-19 15:24:22 -04:00
mixer: fix possible null pointer dereference
This commit is contained in:
@@ -188,11 +188,13 @@ struct mixer_ctl *mixer_get_ctl(struct mixer *mixer, unsigned int id)
|
||||
struct mixer_ctl *mixer_get_ctl_by_name(struct mixer *mixer, const char *name)
|
||||
{
|
||||
unsigned int n;
|
||||
struct mixer_ctl *ctl = mixer->ctl;
|
||||
struct mixer_ctl *ctl;
|
||||
|
||||
if (!mixer)
|
||||
return NULL;
|
||||
|
||||
ctl = mixer->ctl;
|
||||
|
||||
for (n = 0; n < mixer->count; n++)
|
||||
if (!strcmp(name, (char*) ctl[n].info.id.name))
|
||||
return &ctl[n];
|
||||
|
||||
Reference in New Issue
Block a user