accept NULL in 'free' functions
This commit is contained in:
parent
7448f5e5ed
commit
dca142029c
1 changed files with 8 additions and 0 deletions
|
@ -106,6 +106,8 @@ EC_GROUP *EC_GROUP_new(const EC_METHOD *meth)
|
||||||
|
|
||||||
void EC_GROUP_free(EC_GROUP *group)
|
void EC_GROUP_free(EC_GROUP *group)
|
||||||
{
|
{
|
||||||
|
if (!group) return;
|
||||||
|
|
||||||
if (group->meth->group_finish != 0)
|
if (group->meth->group_finish != 0)
|
||||||
group->meth->group_finish(group);
|
group->meth->group_finish(group);
|
||||||
|
|
||||||
|
@ -117,6 +119,8 @@ void EC_GROUP_free(EC_GROUP *group)
|
||||||
|
|
||||||
void EC_GROUP_clear_free(EC_GROUP *group)
|
void EC_GROUP_clear_free(EC_GROUP *group)
|
||||||
{
|
{
|
||||||
|
if (!group) return;
|
||||||
|
|
||||||
if (group->meth->group_clear_finish != 0)
|
if (group->meth->group_clear_finish != 0)
|
||||||
group->meth->group_clear_finish(group);
|
group->meth->group_clear_finish(group);
|
||||||
else if (group->meth != NULL && group->meth->group_finish != 0)
|
else if (group->meth != NULL && group->meth->group_finish != 0)
|
||||||
|
@ -337,6 +341,8 @@ EC_POINT *EC_POINT_new(const EC_GROUP *group)
|
||||||
|
|
||||||
void EC_POINT_free(EC_POINT *point)
|
void EC_POINT_free(EC_POINT *point)
|
||||||
{
|
{
|
||||||
|
if (!point) return;
|
||||||
|
|
||||||
if (point->meth->point_finish != 0)
|
if (point->meth->point_finish != 0)
|
||||||
point->meth->point_finish(point);
|
point->meth->point_finish(point);
|
||||||
OPENSSL_free(point);
|
OPENSSL_free(point);
|
||||||
|
@ -345,6 +351,8 @@ void EC_POINT_free(EC_POINT *point)
|
||||||
|
|
||||||
void EC_POINT_clear_free(EC_POINT *point)
|
void EC_POINT_clear_free(EC_POINT *point)
|
||||||
{
|
{
|
||||||
|
if (!point) return;
|
||||||
|
|
||||||
if (point->meth->point_clear_finish != 0)
|
if (point->meth->point_clear_finish != 0)
|
||||||
point->meth->point_clear_finish(point);
|
point->meth->point_clear_finish(point);
|
||||||
else if (point->meth != NULL && point->meth->point_finish != 0)
|
else if (point->meth != NULL && point->meth->point_finish != 0)
|
||||||
|
|
Loading…
Reference in a new issue