mirror of
https://github.com/Evolution-X/hardware_interfaces
synced 2026-02-01 11:36:00 +00:00
Fix memory leak in WifiLegacyHal.
`WifiLegacyHal::getSupportedRadioCombinationsMatrix()` allocs a buffer and returns it to `WifiChip::getSupportedRadioCombinationsInternal()`, but `WifiChip::getSupportedRadioCombinationsInternal()` never frees it. Bug: 287883356 Test: manually test Change-Id: I0e9d529e93cbb5fe254d48947661a2ae3d99d763
This commit is contained in:
@@ -1452,14 +1452,24 @@ WifiChip::getSupportedRadioCombinationsInternal() {
|
||||
if (legacy_status != legacy_hal::WIFI_SUCCESS) {
|
||||
LOG(ERROR) << "Failed to get SupportedRadioCombinations matrix from legacy HAL: "
|
||||
<< legacyErrorToString(legacy_status);
|
||||
if (legacy_matrix != nullptr) {
|
||||
free(legacy_matrix);
|
||||
}
|
||||
return {aidl_combinations, createWifiStatusFromLegacyError(legacy_status)};
|
||||
}
|
||||
|
||||
if (!aidl_struct_util::convertLegacyRadioCombinationsMatrixToAidl(legacy_matrix,
|
||||
&aidl_combinations)) {
|
||||
LOG(ERROR) << "Failed convertLegacyRadioCombinationsMatrixToAidl() ";
|
||||
if (legacy_matrix != nullptr) {
|
||||
free(legacy_matrix);
|
||||
}
|
||||
return {aidl_combinations, createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS)};
|
||||
}
|
||||
|
||||
if (legacy_matrix != nullptr) {
|
||||
free(legacy_matrix);
|
||||
}
|
||||
return {aidl_combinations, ndk::ScopedAStatus::ok()};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user