mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2024-12-22 13:02:44 +01:00
wiphy: Fix printing supported iftypes
dbus_iftype_to_string returns NULL for unknown iftypes, the strdup will also return NULL and ret[i] will be assigned a NULL. As a result the l_strjoinv will not print the known iftypes that might have come after that and will the l_strfreev will leak the strduped strings.
This commit is contained in:
parent
98623edd7d
commit
e344df432b
@ -310,10 +310,14 @@ static char **wiphy_get_supported_iftypes(struct wiphy *wiphy)
|
||||
unsigned int j;
|
||||
|
||||
for (j = 0, i = 0; i < sizeof(wiphy->supported_iftypes) * 8; i++) {
|
||||
const char *str;
|
||||
|
||||
if (!(wiphy->supported_iftypes & (1 << i)))
|
||||
continue;
|
||||
|
||||
ret[j++] = l_strdup(dbus_iftype_to_string(i + 1));
|
||||
str = dbus_iftype_to_string(i + 1);
|
||||
if (str)
|
||||
ret[j++] = l_strdup(str);
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
Loading…
Reference in New Issue
Block a user