Fix potential crash in trace macro.

* src/signers.c (gpgme_signers_add): Avoid deref of a NULL KEY in the
trace macro.
* src/engine-spawn.c (engspawn_release): Remove always true condition.
* src/engine-gpg.c (gpg_release): Ditto.

Signed-off-by: Werner Koch <wk@gnupg.org>
This commit is contained in:
Werner Koch 2015-03-16 13:40:34 +01:00
parent 119f27032b
commit 8cfcdfe556
No known key found for this signature in database
GPG Key ID: E3FDFF218E45B72B
3 changed files with 3 additions and 5 deletions

View File

@ -396,8 +396,7 @@ gpg_release (void *engine)
{
struct arg_and_data_s *next = gpg->arglist->next;
if (gpg->arglist)
free (gpg->arglist);
free (gpg->arglist);
gpg->arglist = next;
}

View File

@ -355,8 +355,7 @@ engspawn_release (void *engine)
{
struct datalist_s *next = esp->arglist->next;
if (esp->arglist)
free (esp->arglist);
free (esp->arglist);
esp->arglist = next;
}

View File

@ -66,7 +66,7 @@ gpgme_error_t
gpgme_signers_add (gpgme_ctx_t ctx, const gpgme_key_t key)
{
TRACE_BEG2 (DEBUG_CTX, "gpgme_signers_add", ctx,
"key=%p (%s)", key, (key->subkeys && key->subkeys->fpr) ?
"key=%p (%s)", key, (key && key->subkeys && key->subkeys->fpr) ?
key->subkeys->fpr : "invalid");
if (!ctx || !key)