Skip to content

Commit 7feaa4b

Browse files
committed
ProcessExecutor: do not use mutable TimerResults object from parent in forked process
1 parent 11426e8 commit 7feaa4b

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

cli/processexecutor.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -386,12 +386,13 @@ unsigned int ProcessExecutor::check()
386386
#endif
387387
close(pipes[0]);
388388

389-
// reset so we do not have the data which has already been transferred back
389+
// create a separate result object so we do not get the results which have already been transferred back
390+
std::unique_ptr<TimerResults> timerResults;
390391
if (mTimerResults)
391-
mTimerResults->reset();
392+
timerResults.reset(new TimerResults);
392393

393394
PipeWriter pipewriter(pipes[1], mSettings.debugipc);
394-
CppCheck fileChecker(mSettings, supprs, pipewriter, mTimerResults, false, mExecuteCommand);
395+
CppCheck fileChecker(mSettings, supprs, pipewriter, timerResults.get(), false, mExecuteCommand);
395396
unsigned int resultOfCheck = 0;
396397

397398
if (iFileSettings != mFileSettings.end()) {
@@ -403,7 +404,7 @@ unsigned int ProcessExecutor::check()
403404

404405
pipewriter.writeSuppr(supprs.nomsg);
405406

406-
pipewriter.writeTimer(mTimerResults);
407+
pipewriter.writeTimer(timerResults.get());
407408

408409
pipewriter.writeEnd(std::to_string(resultOfCheck));
409410
std::exit(EXIT_SUCCESS);

0 commit comments

Comments
 (0)