From c7328362a9eaa60d7a97fe40bfe63360fb2a1900 Mon Sep 17 00:00:00 2001 From: Svyatoslav Mishyn Date: Sun, 24 Jan 2016 19:43:38 +0200 Subject: mixer: fix possible null pointer dereference --- mixer.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/mixer.c b/mixer.c index fc9123d..7c5c5dc 100644 --- a/mixer.c +++ b/mixer.c @@ -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]; -- cgit v1.2.3