Check for null pointer before applying memwipe()
This commit is contained in:
@@ -643,10 +643,16 @@ METHOD(private_key_t, destroy, void,
|
|||||||
if (ref_put(&this->ref))
|
if (ref_put(&this->ref))
|
||||||
{
|
{
|
||||||
lib->encoding->clear_cache(lib->encoding, this);
|
lib->encoding->clear_cache(lib->encoding, this);
|
||||||
memwipe(this->s1, this->set->n * sizeof(int8_t));
|
if (this->s1)
|
||||||
memwipe(this->s2, this->set->n * sizeof(int8_t));
|
{
|
||||||
free(this->s1);
|
memwipe(this->s1, this->set->n * sizeof(int8_t));
|
||||||
free(this->s2);
|
free(this->s1);
|
||||||
|
}
|
||||||
|
if (this->s2)
|
||||||
|
{
|
||||||
|
memwipe(this->s2, this->set->n * sizeof(int8_t));
|
||||||
|
free(this->s2);
|
||||||
|
}
|
||||||
free(this->A);
|
free(this->A);
|
||||||
free(this);
|
free(this);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user