summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--crypto/ec_signature_creator.cc4
1 files changed, 4 insertions, 0 deletions
diff --git a/crypto/ec_signature_creator.cc b/crypto/ec_signature_creator.cc
index cbaa820..a6887bc 100644
--- a/crypto/ec_signature_creator.cc
+++ b/crypto/ec_signature_creator.cc
@@ -4,6 +4,7 @@
#include "crypto/ec_signature_creator.h"
+#include "base/logging.h"
#include "crypto/ec_signature_creator_impl.h"
namespace crypto {
@@ -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;
}