diff options
author | defanor <defanor@uberspace.net> | 2023-09-29 20:24:16 +0300 |
---|---|---|
committer | defanor <defanor@uberspace.net> | 2023-09-29 20:24:16 +0300 |
commit | ccdb748c81abc9bb30b8989e27d22bbbb219f9a0 (patch) | |
tree | 295be2ea605c8acbe56116ea3ce119b99e3e0440 /src/rexmpp_openpgp.c | |
parent | 04e6fd5194481798bc30abc7a690664d5af36aeb (diff) |
Add more checks, tests, and documentation
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++) { |