diff options
Diffstat (limited to 'src/rexmpp_openpgp.c')
-rw-r--r-- | src/rexmpp_openpgp.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/rexmpp_openpgp.c b/src/rexmpp_openpgp.c index 4ef7335..222ae6b 100644 --- a/src/rexmpp_openpgp.c +++ b/src/rexmpp_openpgp.c @@ -732,6 +732,11 @@ char *rexmpp_openpgp_payload (rexmpp_t *s, /* Add keys for encryption. */ allocated = 8; keys = malloc(sizeof(gpgme_key_t *) * allocated); + if (keys == NULL) { + rexmpp_log(s, LOG_ERR, "Failed to allocate memory for keys"); + rexmpp_xml_free(elem); + return NULL; + } keys[0] = NULL; rexmpp_openpgp_add_keys(s, s->initial_jid.bare, &keys, &nkeys, &allocated); for (i = 0; recipients[i] != NULL; i++) { |