Signed-off-by: Rich Salz <rsalz@akamai.com>
Reviewed-by: Matt Caswell <matt@openssl.org>
if (lock == NULL)
return NULL;
- if (pthread_rwlock_init(lock, NULL) != 0)
+ if (pthread_rwlock_init(lock, NULL) != 0) {
+ OPENSSL_free(lock);
return NULL;
+ }
return lock;
}
return NULL;
/* 0x400 is the spin count value suggested in the documentation */
- if (!InitializeCriticalSectionAndSpinCount(lock, 0x400))
+ if (!InitializeCriticalSectionAndSpinCount(lock, 0x400)) {
+ OPENSSL_free(lock);
return NULL;
+ }
return lock;
}