Skip to content

Commit

Permalink
Remove a leak when quit() is used in interactive mode, the buffer hol… (
Browse files Browse the repository at this point in the history
#22371)

* Remove a leak when quit() is used in interactive mode, the buffer holding the command not beeing freed

* Apply suggestions from code review

Co-authored-by: Boris Zbarsky <[email protected]>
  • Loading branch information
vivien-apple and bzbarsky-apple authored Sep 6, 2022
1 parent 2025691 commit 58fd10a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,12 @@ CHIP_ERROR InteractiveStartCommand::RunCommand()
}
}

if (command != nullptr)
{
free(command);
command = nullptr;
}

SetCommandExitStatus(CHIP_NO_ERROR);
return CHIP_NO_ERROR;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,11 @@ el_status_t StopFunction()
}
}

if (command != nullptr) {
free(command);
command = nullptr;
}

SetCommandExitStatus(CHIP_NO_ERROR);
return CHIP_NO_ERROR;
}
Expand Down

0 comments on commit 58fd10a

Please sign in to comment.