Its ok to pass down NULL as the context handle to error string function
Just ignore setting the error string if that is the case.
This commit is contained in:
@@ -67,9 +67,11 @@ free_error_string(hx509_error msg)
|
|||||||
void
|
void
|
||||||
hx509_clear_error_string(hx509_context context)
|
hx509_clear_error_string(hx509_context context)
|
||||||
{
|
{
|
||||||
|
if (context) {
|
||||||
free_error_string(context->error);
|
free_error_string(context->error);
|
||||||
context->error = NULL;
|
context->error = NULL;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add an error message to the hx509 context.
|
* Add an error message to the hx509 context.
|
||||||
@@ -91,6 +93,9 @@ hx509_set_error_stringv(hx509_context context, int flags, int code,
|
|||||||
{
|
{
|
||||||
hx509_error msg;
|
hx509_error msg;
|
||||||
|
|
||||||
|
if (context == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
msg = calloc(1, sizeof(*msg));
|
msg = calloc(1, sizeof(*msg));
|
||||||
if (msg == NULL) {
|
if (msg == NULL) {
|
||||||
hx509_clear_error_string(context);
|
hx509_clear_error_string(context);
|
||||||
|
Reference in New Issue
Block a user