Commit 1c21cf89 authored by Abdun Nihaal's avatar Abdun Nihaal Committed by Luiz Augusto von Dentz
Browse files

Bluetooth: btrtl: Fix memory leak in rtlbt_parse_firmware_v2()



The memory allocated for ptr using kvmalloc() is not freed on the last
error path. Fix that by freeing it on that error path.

Fixes: 9a24ce5e ("Bluetooth: btrtl: Firmware format v2 support")
Signed-off-by: default avatarAbdun Nihaal <nihaal@cse.iitm.ac.in>
Signed-off-by: default avatarLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
parent 5c5f1f64
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -625,8 +625,10 @@ static int rtlbt_parse_firmware_v2(struct hci_dev *hdev,
		len += entry->len;
	}

	if (!len)
	if (!len) {
		kvfree(ptr);
		return -EPERM;
	}

	*_buf = ptr;
	return len;