common: Fix check_after_deref in cockpit_certificate_locate()

There is no need to check `error` in the condition, as the code above
already dereferences it. Spotted by Coverity.
This commit is contained in:
Martin Pitt 2021-04-22 13:05:46 +02:00 committed by Allison Karlitskaya
parent c05a36219b
commit f2e885341d
1 changed files with 2 additions and 1 deletions

View File

@ -99,6 +99,7 @@ cockpit_certificate_locate (bool missing_ok,
{
const char * const *dirs = cockpit_conf_get_dirs ();
assert (error != NULL);
assert (*error == NULL);
for (int i = 0; dirs[i]; i++)
@ -117,7 +118,7 @@ cockpit_certificate_locate (bool missing_ok,
return cert_path;
}
if (error && !missing_ok)
if (!missing_ok)
asprintfx (error, "No certificate found in dir: %s/cockpit/ws-certs.d", dirs[0]);
return NULL;