about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--src/xmpp/omemo.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/xmpp/omemo.c b/src/xmpp/omemo.c
index e0f2a70d..e44cc00e 100644
--- a/src/xmpp/omemo.c
+++ b/src/xmpp/omemo.c
@@ -168,13 +168,18 @@ omemo_start_device_session_handle_bundle(xmpp_stanza_t *const stanza, void *cons
 
         const char *prekey_id_text = xmpp_stanza_get_attribute(prekey, "preKeyId");
         if (!prekey_id_text) {
+            omemo_key_free(key);
             goto out;
         }
+
         key->id = strtoul(prekey_id_text, NULL, 10);
         xmpp_stanza_t *prekey_text = xmpp_stanza_get_children(prekey);
+
         if (!prekey_text) {
+            omemo_key_free(key);
             goto out;
         }
+
         char *prekey_b64 = xmpp_stanza_get_text(prekey_text);
         key->data = g_base64_decode(prekey_b64, &key->length);
         free(prekey_b64);