Skip to content

Commit

Permalink
Fix use after free
Browse files Browse the repository at this point in the history
  • Loading branch information
SammyVimes committed Jan 26, 2024
1 parent a276799 commit ceed7ff
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
13 changes: 5 additions & 8 deletions ydb/core/blobstorage/pdisk/blobstorage_pdisk_impl_log.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,27 +13,24 @@ class TLogFlushCompletionAction : public TCompletionAction {
const ui32 EndChunkIdx;
const ui32 EndSectorIdx;
THolder<TLogWriter> &CommonLogger;
TCompletionAction* CompletionLogWrite;
public:
TLogFlushCompletionAction(ui32 endChunkIdx, ui32 endSectorIdx, THolder<TLogWriter> &commonLogger, TCompletionAction* completionLogWrite)
: EndChunkIdx(endChunkIdx)
, EndSectorIdx(endSectorIdx)
, CommonLogger(commonLogger) {
this->FlushAction = completionLogWrite;
}
, CommonLogger(commonLogger)
, CompletionLogWrite(completionLogWrite) { }

void Exec(TActorSystem *actorSystem) override {
CommonLogger->FirstUncommitted = TFirstUncommitted(EndChunkIdx, EndSectorIdx);

Y_DEBUG_ABORT_UNLESS(FlushAction);

// FlushAction here is a TCompletionLogWrite which will decrease owner's inflight count.
FlushAction->Exec(actorSystem);
CompletionLogWrite->Exec(actorSystem);

delete this;
}

void Release(TActorSystem *actorSystem) override {
FlushAction->Release(actorSystem);
CompletionLogWrite->Release(actorSystem);

delete this;
}
Expand Down
1 change: 1 addition & 0 deletions ydb/core/blobstorage/pdisk/blobstorage_pdisk_state.h
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@ struct TOwnerData {
CurrentFirstLsnToKeep = 0;
LastWrittenCommitLsn = 0;
CutLogId = TActorId();
LogEndPosition = TLogEndPosition(0, 0);
WhiteboardProxyId = TActorId();
LogRecordsInitiallyRead = 0;
LogRecordsConsequentlyRead = 0;
Expand Down

0 comments on commit ceed7ff

Please sign in to comment.