Skip to content

Commit

Permalink
fix memory leak in libfibre
Browse files Browse the repository at this point in the history
  • Loading branch information
samuelsadok authored Jan 26, 2022
1 parent 27aefbb commit 8691e88
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions Firmware/fibre-cpp/legacy_object_client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -477,13 +477,12 @@ void LegacyCallContext::resume_from_protocol(EndpointOperationResult result) {
auto continuation = get_next_task(res);
if (continuation.index() == 0) {
auto app_result = callback.invoke(std::get<0>(continuation));
if (!app_result.has_value()) {
return; // app will resume asynchronously
} else if (std::get<0>(continuation).status != kFibreOk) {
if (app_result->status != kFibreClosed || app_result->rx_buf.size() || app_result->tx_buf.size()) {
if (std::get<0>(continuation).status != kFibreOk) {
if (app_result.has_value() && (app_result->status != kFibreClosed || app_result->rx_buf.size() || app_result->tx_buf.size())) {
FIBRE_LOG(W) << "app tried to continue a closed call";
}
FIBRE_LOG(T) << "closing call";
delete this;
return;
} else {
res = *app_result;
Expand Down

0 comments on commit 8691e88

Please sign in to comment.