]> git.alsa-project.org Git - alsa-lib.git/commitdiff
topology: tplg_elem_lookup() checks parameter before searching
authorMengdong Lin <mengdong.lin@linux.intel.com>
Thu, 3 Nov 2016 23:08:27 +0000 (07:08 +0800)
committerTakashi Iwai <tiwai@suse.de>
Sat, 5 Nov 2016 15:41:55 +0000 (16:41 +0100)
Check the parameters at first in case of misuse.

Signed-off-by: Mengdong Lin <mengdong.lin@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
src/topology/elem.c

index 029c9abf7db7f45d34de524ae078e507d8cd001b..724bf26287067d5fd8f6415a3c6dc1d2b17c737f 100644 (file)
@@ -111,6 +111,9 @@ struct tplg_elem *tplg_elem_lookup(struct list_head *base, const char* id,
        struct list_head *pos;
        struct tplg_elem *elem;
 
+       if (!base || !id)
+               return NULL;
+
        list_for_each(pos, base) {
 
                elem = list_entry(pos, struct tplg_elem, list);