File tree 1 file changed +6
-6
lines changed 1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -245,6 +245,10 @@ SimpleHttpResult* SimpleHttpClient::doRequest(
245
245
246
246
// create a new result
247
247
_result = new SimpleHttpResult ();
248
+ auto resultGuard = scopeGuard ([this ] {
249
+ delete _result;
250
+ _result = nullptr ;
251
+ });
248
252
249
253
// reset error message
250
254
_errorMessage = " " ;
@@ -326,8 +330,6 @@ SimpleHttpResult* SimpleHttpClient::doRequest(
326
330
327
331
if (_connection->isInterrupted ()) {
328
332
this ->close ();
329
- delete _result;
330
- _result = nullptr ;
331
333
setErrorMessage (" Command locally aborted" );
332
334
return nullptr ;
333
335
}
@@ -407,10 +409,8 @@ SimpleHttpResult* SimpleHttpClient::doRequest(
407
409
break ;
408
410
}
409
411
410
- if ( application_features::ApplicationServer::isStopping ()) {
412
+ if (application_features::ApplicationServer::isStopping ()) {
411
413
setErrorMessage (" Command locally aborted" );
412
- delete _result;
413
- _result = nullptr ;
414
414
return nullptr ;
415
415
}
416
416
@@ -428,8 +428,8 @@ SimpleHttpResult* SimpleHttpClient::doRequest(
428
428
429
429
// set result type in getResult()
430
430
SimpleHttpResult* result = getResult (haveSentRequest);
431
-
432
431
_result = nullptr ;
432
+ resultGuard.cancel (); // doesn't matter but do it anyway
433
433
434
434
return result;
435
435
}
You can’t perform that action at this time.
0 commit comments