Fix memory leaks in pgpmime_sign() and pgpmime_encrypt()
authorAndrej Kacian <ticho@claws-mail.org>
Tue, 23 Apr 2019 21:58:22 +0000 (23:58 +0200)
committerAndrej Kacian <ticho@claws-mail.org>
Sat, 4 May 2019 14:42:58 +0000 (16:42 +0200)
src/plugins/pgpmime/pgpmime.c

index 5633e0f3d7d4429cce25b45e83aceadd219220b1..bd64439d92f35fb8c5362b754058ed8912943f70 100644 (file)
@@ -601,6 +601,7 @@ gboolean pgpmime_sign(MimeInfo *mimeinfo, PrefsAccount *account, const gchar *fr
        newinfo->data.mem = g_malloc(len + 1);
        g_memmove(newinfo->data.mem, sigcontent, len);
        newinfo->data.mem[len] = '\0';
+       newinfo->tmp = TRUE;
        g_node_append(sigmultipart->node, newinfo->node);
 
        g_free(sigcontent);
@@ -736,6 +737,7 @@ gboolean pgpmime_encrypt(MimeInfo *mimeinfo, const gchar *encrypt_data)
        newinfo->subtype = g_strdup("pgp-encrypted");
        newinfo->content = MIMECONTENT_MEM;
        newinfo->data.mem = g_strdup("Version: 1\n");
+       newinfo->tmp = TRUE;
        g_node_append(encmultipart->node, newinfo->node);
 
        newinfo = procmime_mimeinfo_new();
@@ -743,6 +745,7 @@ gboolean pgpmime_encrypt(MimeInfo *mimeinfo, const gchar *encrypt_data)
        newinfo->subtype = g_strdup("octet-stream");
        newinfo->content = MIMECONTENT_MEM;
        newinfo->data.mem = g_malloc(len + 1);
+       newinfo->tmp = TRUE;
        g_memmove(newinfo->data.mem, enccontent, len);
        newinfo->data.mem[len] = '\0';
        g_node_append(encmultipart->node, newinfo->node);