Skip to content

Commit 350d791

Browse files
author
Mirela Chirica
committed
Release AT handler if network not created
1 parent aaf4edc commit 350d791

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

features/cellular/framework/targets/QUECTEL/BG96/QUECTEL_BG96.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,13 @@ QUECTEL_BG96::~QUECTEL_BG96()
4040
CellularNetwork *QUECTEL_BG96::open_network(FileHandle *fh)
4141
{
4242
if (!_network) {
43-
_network = new QUECTEL_BG96_CellularNetwork(*get_at_handler(fh));
43+
ATHandler *atHandler = get_at_handler(fh);
44+
if (atHandler) {
45+
_network = new QUECTEL_BG96_CellularNetwork(*atHandler);
46+
if (!_network) {
47+
release_at_handler(atHandler);
48+
}
49+
}
4450
}
4551
return _network;
4652
}

0 commit comments

Comments
 (0)