8000 Fix SimpleHttpClient assertions (#6914) · mnemosdev/arangodb@63cfdad · GitHub
[go: up one dir, main page]

Skip to content

Commit 63cfdad

Browse files
graetzerjsteemann
authored andcommitted
Fix SimpleHttpClient assertions (arangodb#6914)
(cherry picked from commit 0d36790)
1 parent 18b2eb6 commit 63cfdad

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

lib/SimpleHttpClient/SimpleHttpClient.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,10 @@ SimpleHttpResult* SimpleHttpClient::doRequest(
245245

246246
// create a new result
247247
_result = new SimpleHttpResult();
248+
auto resultGuard = scopeGuard([this] {
249+
delete _result;
250+
_result = nullptr;
251+
});
248252

249253
// reset error message
250254
_errorMessage = "";
@@ -326,8 +330,6 @@ SimpleHttpResult* SimpleHttpClient::doRequest(
326330

327331
if (_connection->isInterrupted()) {
328332
this->close();
329-
delete _result;
330-
_result = nullptr;
331333
setErrorMessage("Command locally aborted");
332334
return nullptr;
333335
}
@@ -407,10 +409,8 @@ SimpleHttpResult* SimpleHttpClient::doRequest(
407409
break;
408410
}
409411

410-
if ( application_features::ApplicationServer::isStopping()) {
412+
if (application_features::ApplicationServer::isStopping()) {
411413
setErrorMessage("Command locally aborted");
412-
delete _result;
413-
_result = nullptr;
414414
return nullptr;
415415
}
416416

@@ -428,8 +428,8 @@ SimpleHttpResult* SimpleHttpClient::doRequest(
428428

429429
// set result type in getResult()
430430
SimpleHttpResult* result = getResult(haveSentRequest);
431-
432431
_result = nullptr;
432+
resultGuard.cancel(); // doesn't matter but do it anyway
433433

434434
return result;
435435
}

0 commit comments

Comments
 (0)
0