Skip to content

Commit 71a1ed9

Browse files
author
Teemu Kultala
committed
cellular: BC95 memory leak fix
1 parent fa65546 commit 71a1ed9

File tree

3 files changed

+5
-2
lines changed

3 files changed

+5
-2
lines changed

UNITTESTS/features/cellular/framework/AT/at_cellularnetwork/at_cellularnetworktest.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,13 +122,15 @@ TEST_F(TestAT_CellularNetwork, test_AT_CellularNetwork_get_registration_params)
122122
EXPECT_TRUE(reg_params._status == CellularNetwork::RegistrationDenied);
123123
EXPECT_TRUE(reg_params._act == CellularNetwork::RAT_EGPRS);
124124
EXPECT_TRUE(reg_params._cell_id == -1);
125+
EXPECT_TRUE(reg_params._lac == -1);
125126

126127
ATHandler_stub::read_string_index = 4;
127128
ATHandler_stub::read_string_table[3] = "00C3";
128129
ATHandler_stub::read_string_table[2] = "1234FFC1";//== cellid and in dec: 305463233
129130
ATHandler_stub::read_string_table[1] = "00100100";
130131
ATHandler_stub::read_string_table[0] = "01000111";
131132
EXPECT_TRUE(NSAPI_ERROR_OK == cn.get_registration_params(CellularNetwork::C_EREG, reg_params));
133+
EXPECT_TRUE(reg_params._lac == 0xc3);
132134
EXPECT_TRUE(reg_params._cell_id == 305463233);
133135
EXPECT_TRUE(reg_params._active_time == 240);
134136
EXPECT_TRUE(reg_params._periodic_tau == 70 * 60 * 60);

features/cellular/framework/AT/AT_CellularNetwork.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,7 @@ void AT_CellularNetwork::read_reg_params_and_compare(RegistrationType type)
177177
}
178178
if (reg_params._cell_id != -1 && reg_params._cell_id != _reg_params._cell_id) {
179179
_reg_params._cell_id = reg_params._cell_id;
180+
_reg_params._lac = reg_params._lac;
180181
data.status_data = reg_params._cell_id;
181182
_connection_status_cb((nsapi_event_t)CellularCellIDChanged, (intptr_t)&data);
182183
}

features/cellular/framework/targets/QUECTEL/BC95/QUECTEL_BC95_CellularStack.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ nsapi_size_or_error_t QUECTEL_BC95_CellularStack::socket_sendto_impl(CellularSoc
190190
_at.write_int(socket->id);
191191
_at.write_int(size);
192192
} else {
193-
delete hexstr;
193+
delete [] hexstr;
194194
return NSAPI_ERROR_PARAMETER;
195195
}
196196

@@ -202,7 +202,7 @@ nsapi_size_or_error_t QUECTEL_BC95_CellularStack::socket_sendto_impl(CellularSoc
202202
sent_len = _at.read_int();
203203
_at.resp_stop();
204204

205-
delete hexstr;
205+
delete [] hexstr;
206206

207207
if (_at.get_last_error() == NSAPI_ERROR_OK) {
208208
return sent_len;

0 commit comments

Comments
 (0)