Skip to content

cellular: BC95 memory leak fix #9972

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from Mar 15, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -122,13 +122,15 @@ TEST_F(TestAT_CellularNetwork, test_AT_CellularNetwork_get_registration_params)
EXPECT_TRUE(reg_params._status == CellularNetwork::RegistrationDenied);
EXPECT_TRUE(reg_params._act == CellularNetwork::RAT_EGPRS);
EXPECT_TRUE(reg_params._cell_id == -1);
EXPECT_TRUE(reg_params._lac == -1);

ATHandler_stub::read_string_index = 4;
ATHandler_stub::read_string_table[3] = "00C3";
ATHandler_stub::read_string_table[2] = "1234FFC1";//== cellid and in dec: 305463233
ATHandler_stub::read_string_table[1] = "00100100";
ATHandler_stub::read_string_table[0] = "01000111";
EXPECT_TRUE(NSAPI_ERROR_OK == cn.get_registration_params(CellularNetwork::C_EREG, reg_params));
EXPECT_TRUE(reg_params._lac == 0xc3);
EXPECT_TRUE(reg_params._cell_id == 305463233);
EXPECT_TRUE(reg_params._active_time == 240);
EXPECT_TRUE(reg_params._periodic_tau == 70 * 60 * 60);
Expand Down
1 change: 1 addition & 0 deletions features/cellular/framework/AT/AT_CellularNetwork.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ void AT_CellularNetwork::read_reg_params_and_compare(RegistrationType type)
}
if (reg_params._cell_id != -1 && reg_params._cell_id != _reg_params._cell_id) {
_reg_params._cell_id = reg_params._cell_id;
_reg_params._lac = reg_params._lac;
data.status_data = reg_params._cell_id;
_connection_status_cb((nsapi_event_t)CellularCellIDChanged, (intptr_t)&data);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ nsapi_size_or_error_t QUECTEL_BC95_CellularStack::socket_sendto_impl(CellularSoc
_at.write_int(socket->id);
_at.write_int(size);
} else {
delete hexstr;
delete [] hexstr;
return NSAPI_ERROR_PARAMETER;
}

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

delete hexstr;
delete [] hexstr;

if (_at.get_last_error() == NSAPI_ERROR_OK) {
return sent_len;
Expand Down