* Copyright (c) 2013--2014 Tom Gundersen <teg@jklm.no>
* Copyright (c) 2014 Martin Mares <mj@ucw.cz>
*
- * Can be freely distributed and used under the terms of the GNU GPL.
+ * Can be freely distributed and used under the terms of the GNU GPL v2+.
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
*/
#include <string.h>
struct udev_list_entry *entry;
udev_list_entry_foreach(entry, udev_hwdb_get_properties_list_entry(a->id_udev_hwdb, modalias, 0))
- if (strcmp(udev_list_entry_get_name(entry), key) == 0)
- return pci_strdup(a, udev_list_entry_get_value(entry));
+ {
+ const char *entry_name = udev_list_entry_get_name(entry);
+ if (entry_name && !strcmp(entry_name, key))
+ {
+ const char *entry_value = udev_list_entry_get_value(entry);
+ if (entry_value)
+ return pci_strdup(a, entry_value);
+ }
+ }
}
return NULL;