Skip to content

Commit

Permalink
Add a DCHECK to ECSignatureCreator::SetFactoryForTesting to help avoi…
Browse files Browse the repository at this point in the history
…d use-after-free problems.

Review URL: https://chromiumcodereview.appspot.com/10828118

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@149506 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
rch@chromium.org committed Aug 1, 2012
1 parent 6d52377 commit 34b1289
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions crypto/ec_signature_creator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

#include "crypto/ec_signature_creator.h"

#include "base/logging.h"
#include "crypto/ec_signature_creator_impl.h"

namespace crypto {
Expand All @@ -24,6 +25,9 @@ ECSignatureCreator* ECSignatureCreator::Create(ECPrivateKey* key) {
// static
void ECSignatureCreator::SetFactoryForTesting(
ECSignatureCreatorFactory* factory) {
// We should always clear the factory after each test to avoid
// use-after-free problems.
DCHECK(!g_factory_ || !factory);
g_factory_ = factory;
}

Expand Down

0 comments on commit 34b1289

Please sign in to comment.