Merged in ENGINE-638 sync
authorKrista 'DarthMama' Bennett <krista@pep.foundation>
Fri, 04 Oct 2019 16:43:45 +0200
branchsync
changeset 4110e064aa840c9c
parent 4107 0742fa2654a7
parent 4109 7200575b3b89
child 4112 e5ce72ce4e5a
child 4115 02086eb45639
child 4117 60d786f077a8
Merged in ENGINE-638
     1.1 --- a/src/pgp_sequoia.c	Fri Oct 04 16:17:41 2019 +0200
     1.2 +++ b/src/pgp_sequoia.c	Fri Oct 04 16:43:45 2019 +0200
     1.3 @@ -1706,8 +1706,8 @@
     1.4          ERROR_OUT(NULL, status, "Looking up key for signing '%s'", keylist->value);
     1.5      }
     1.6  
     1.7 -    pgp_writer_t writer = pgp_writer_alloc((void **) ctext, csize);
     1.8 -    writer = pgp_armor_writer_new(&err, writer,
     1.9 +    pgp_writer_t writer_alloc = pgp_writer_alloc((void **) ctext, csize);
    1.10 +    pgp_writer_t writer = pgp_armor_writer_new(&err, writer_alloc,
    1.11                                    PGP_ARMOR_KIND_MESSAGE, NULL, 0);
    1.12      if (!writer)
    1.13          ERROR_OUT(err, PEP_UNKNOWN_ERROR, "Setting up armor writer");
    1.14 @@ -1759,6 +1759,8 @@
    1.15      if (pgp_status != 0)
    1.16          ERROR_OUT(err, PEP_UNKNOWN_ERROR, "Flushing writer");
    1.17  
    1.18 +    pgp_writer_free (writer_alloc);
    1.19 +
    1.20      // Add a terminating NUL for naive users
    1.21      void *t = realloc(*ctext, *csize + 1);
    1.22      if (! t) {