g10: Fix memory leak.
authorJustus Winter <justus@g10code.com>
Thu, 30 Jun 2016 16:49:15 +0000 (18:49 +0200)
committerJustus Winter <justus@g10code.com>
Thu, 30 Jun 2016 16:50:16 +0000 (18:50 +0200)
* g10/export.c (do_export_stream): Free secret parameters.

Signed-off-by: Justus Winter <justus@g10code.com>
g10/export.c

index b067376..4137235 100644 (file)
@@ -1557,6 +1557,15 @@ do_export_stream (ctrl_t ctrl, iobuf_t out, strlist_t users, int secret,
 
               xfree (pk->seckey_info);
               pk->seckey_info = NULL;
+              {
+                int i;
+                for (i = pubkey_get_npkey (pk->pubkey_algo);
+                     i < pubkey_get_nskey (pk->pubkey_algo); i++)
+                  {
+                    gcry_mpi_release (pk->pkey[i]);
+                    pk->pkey[i] = NULL;
+                  }
+              }
               xfree (hexgrip);
             }
           else