From 350d7916cf208447b022c8df440887c3ec9d9a9f Mon Sep 17 00:00:00 2001 From: Mirela Chirica Date: Thu, 8 Mar 2018 12:50:14 +0200 Subject: [PATCH] Release AT handler if network not created --- .../framework/targets/QUECTEL/BG96/QUECTEL_BG96.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/features/cellular/framework/targets/QUECTEL/BG96/QUECTEL_BG96.cpp b/features/cellular/framework/targets/QUECTEL/BG96/QUECTEL_BG96.cpp index 5fd746d48e..59b090ccc6 100644 --- a/features/cellular/framework/targets/QUECTEL/BG96/QUECTEL_BG96.cpp +++ b/features/cellular/framework/targets/QUECTEL/BG96/QUECTEL_BG96.cpp @@ -40,7 +40,13 @@ QUECTEL_BG96::~QUECTEL_BG96() CellularNetwork *QUECTEL_BG96::open_network(FileHandle *fh) { if (!_network) { - _network = new QUECTEL_BG96_CellularNetwork(*get_at_handler(fh)); + ATHandler *atHandler = get_at_handler(fh); + if (atHandler) { + _network = new QUECTEL_BG96_CellularNetwork(*atHandler); + if (!_network) { + release_at_handler(atHandler); + } + } } return _network; }