mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2024-12-22 13:02:44 +01:00
hwsim: Fix potential memory leak
If msg has multiple RADIO NAME attributes, memory leak occurs. Note that this doesn't happen in practice.
This commit is contained in:
parent
b096c27377
commit
25b3cb77e1
@ -312,11 +312,12 @@ static void list_callback(struct l_genl_msg *msg, void *user_data)
|
||||
break;
|
||||
|
||||
case HWSIM_ATTR_RADIO_NAME:
|
||||
hwname = l_malloc(len + 1);
|
||||
if (hwname) {
|
||||
if (!hwname) {
|
||||
hwname = l_new(char, len + 1);
|
||||
|
||||
strncpy(hwname, data, len);
|
||||
hwname[len] = '\0';
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
|
Loading…
Reference in New Issue
Block a user