diff options
author | Svyatoslav Mishyn <juef@openmailbox.org> | 2016-01-24 19:43:38 +0200 |
---|---|---|
committer | Svyatoslav Mishyn <juef@openmailbox.org> | 2016-01-24 19:43:38 +0200 |
commit | c7328362a9eaa60d7a97fe40bfe63360fb2a1900 (patch) | |
tree | ff50d5c0bc7412e9437e3911017475c4e3cf3c86 | |
parent | ad66b45add9677c4a732fc3a020f7b5d19c38def (diff) |
mixer: fix possible null pointer dereference
-rw-r--r-- | mixer.c | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -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]; |