Skip to content

Commit

Permalink
Fix segfault in gmock when running tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Peter-Levine authored Jul 24, 2017
1 parent 11607eb commit a83a1b3
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions test/gmock-1.7.0/include/gmock/gmock-spec-builders.h
Original file line number Diff line number Diff line change
Expand Up @@ -1370,6 +1370,8 @@ class ActionResultHolder : public UntypedActionResultHolderBase {
template <>
class ActionResultHolder<void> : public UntypedActionResultHolderBase {
public:
explicit ActionResultHolder() {}

void GetValueAndDelete() const { delete this; }

virtual void PrintAsActionResult(::std::ostream* /* os */) const {}
Expand All @@ -1381,7 +1383,7 @@ class ActionResultHolder<void> : public UntypedActionResultHolderBase {
const typename Function<F>::ArgumentTuple& args,
const string& call_description) {
func_mocker->PerformDefaultAction(args, call_description);
return NULL;
return new ActionResultHolder();
}

// Performs the given action and returns NULL.
Expand All @@ -1390,7 +1392,7 @@ class ActionResultHolder<void> : public UntypedActionResultHolderBase {
const Action<F>& action,
const typename Function<F>::ArgumentTuple& args) {
action.Perform(args);
return NULL;
return new ActionResultHolder();
}
};

Expand Down

0 comments on commit a83a1b3

Please sign in to comment.