Skip to content

Commit

Permalink
Prevent double free on exception
Browse files Browse the repository at this point in the history
  • Loading branch information
stuartwdouglas authored and gsmet committed Jan 21, 2021
1 parent 948d381 commit 1a6f102
Showing 1 changed file with 1 addition and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -142,11 +142,7 @@ private CompletionStage<Void> asyncFlush(boolean isLast) {
if (pooledBuffer != null) {
ByteBuf sentBuffer = pooledBuffer;
pooledBuffer = null;
CompletionStage<Void> ret = response.writeNonBlocking(sentBuffer, isLast);
return ret.whenComplete((v, t) -> {
if (t != null)
sentBuffer.release();
});
return response.writeNonBlocking(sentBuffer, isLast);
}
return CompletableFuture.completedFuture(null);
}
Expand Down

0 comments on commit 1a6f102

Please sign in to comment.