1
0
Fork 0
mirror of https://github.com/deltachat/deltachat-core.git synced 2025-10-04 18:29:19 +02:00

fix memory leak in netpgp's pgp_sign_buf()

This commit is contained in:
B. Petersen 2017-11-28 16:14:29 +01:00
parent fc95d55a28
commit b0debf54e0

View file

@ -1224,7 +1224,7 @@ pgp_sign_buf(pgp_io_t *io,
pgp_sig_type_t sig_type; pgp_sig_type_t sig_type;
pgp_hash_alg_t hash_alg; pgp_hash_alg_t hash_alg;
pgp_output_t *output; pgp_output_t *output;
pgp_memory_t *mem; pgp_memory_t *mem = NULL;
uint8_t keyid[PGP_KEY_ID_SIZE]; uint8_t keyid[PGP_KEY_ID_SIZE];
pgp_hash_t *hash; pgp_hash_t *hash;
unsigned ret; unsigned ret;
@ -1232,7 +1232,7 @@ pgp_sign_buf(pgp_io_t *io,
sig = NULL; sig = NULL;
sig_type = PGP_SIG_BINARY; sig_type = PGP_SIG_BINARY;
output = NULL; output = NULL;
mem = pgp_memory_new(); //mem = pgp_memory_new(); // EDIT BY MR: fix memory leak - pointer is overwritten by pgp_setup_memory_write() below
hash = NULL; hash = NULL;
hash_alg = pgp_str_to_hash_alg(hashname); hash_alg = pgp_str_to_hash_alg(hashname);
@ -1259,7 +1259,7 @@ pgp_sign_buf(pgp_io_t *io,
pgp_start_sig(sig, seckey, hash_alg, sig_type); pgp_start_sig(sig, seckey, hash_alg, sig_type);
/* setup writer */ /* setup writer */
pgp_setup_memory_write(&output, &mem, insize); pgp_setup_memory_write(&output, &mem, insize); /* calls pgp_output_new() and pgp_memory_new() */
if (cleartext) { if (cleartext) {
/* Do the signing */ /* Do the signing */