mirror of
https://gitea.osmocom.org/cellular-infrastructure/osmo-trx.git
synced 2025-11-19 21:38:08 +00:00
transceiver: Fix mismatched allocations and deallocations
The behaviour of a mismatched pair of allocation and deallocation is undefined Also fixes a memory leak if malloc fails (which stops the application anyway) Change-Id: I9c8bbade8531e8c9c02dcd43bac38cb954b3c89f
This commit is contained in:
@@ -80,8 +80,10 @@ bool ChannelizerBase::initFilters()
|
||||
return false;
|
||||
|
||||
subFilters = (float **) malloc(sizeof(float *) * m);
|
||||
if (!subFilters)
|
||||
if (!subFilters) {
|
||||
delete[] proto;
|
||||
return false;
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < m; i++) {
|
||||
subFilters[i] = (float *)
|
||||
@@ -122,7 +124,7 @@ bool ChannelizerBase::initFilters()
|
||||
for (size_t i = 0; i < m; i++)
|
||||
reverse(subFilters[i], hLen);
|
||||
|
||||
delete proto;
|
||||
delete[] proto;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user