diff options
Diffstat (limited to 'src/rexmpp_openpgp.c')
-rw-r--r-- | src/rexmpp_openpgp.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/rexmpp_openpgp.c b/src/rexmpp_openpgp.c index 222ae6b..14e2d35 100644 --- a/src/rexmpp_openpgp.c +++ b/src/rexmpp_openpgp.c @@ -619,7 +619,15 @@ void rexmpp_openpgp_add_keys (rexmpp_t *s, *nkeys = *nkeys + 1; if (*nkeys == *allocated) { *allocated = *allocated * 2; - *keys = realloc(*keys, sizeof(gpgme_key_t *) * *allocated); + gpgme_key_t *new_keys = + realloc(*keys, sizeof(gpgme_key_t *) * *allocated); + if (new_keys == NULL) { + rexmpp_log(s, LOG_ERR, + "Failed to reallocate the OpenPGP keys array: %s", + strerror(errno)); + continue; + } + *keys = new_keys; } } else { gpgme_key_unref((*keys)[*nkeys]); |