Add a DCHECK to ECSignatureCreator::SetFactoryForTesting to help avoid 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
This commit is contained in:
@@ -4,6 +4,7 @@
|
|||||||
|
|
||||||
#include "crypto/ec_signature_creator.h"
|
#include "crypto/ec_signature_creator.h"
|
||||||
|
|
||||||
|
#include "base/logging.h"
|
||||||
#include "crypto/ec_signature_creator_impl.h"
|
#include "crypto/ec_signature_creator_impl.h"
|
||||||
|
|
||||||
namespace crypto {
|
namespace crypto {
|
||||||
@@ -24,6 +25,9 @@ ECSignatureCreator* ECSignatureCreator::Create(ECPrivateKey* key) {
|
|||||||
// static
|
// static
|
||||||
void ECSignatureCreator::SetFactoryForTesting(
|
void ECSignatureCreator::SetFactoryForTesting(
|
||||||
ECSignatureCreatorFactory* factory) {
|
ECSignatureCreatorFactory* factory) {
|
||||||
|
// We should always clear the factory after each test to avoid
|
||||||
|
// use-after-free problems.
|
||||||
|
DCHECK(!g_factory_ || !factory);
|
||||||
g_factory_ = factory;
|
g_factory_ = factory;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user