gpgme memory leak? What's wrong?

Vladimir S. Petukhov vladimir at sycore.org
Mon Feb 27 19:18:00 CET 2006


Hi!

Sorry for my English...

Next code:

while (true) {
  GpgmeCtx gpgme_ctx;
  gpgme_new (&gpgme_ctx);

  gpgme_set_textmode (gpgme_ctx, 1);
  gpgme_set_armor (gpgme_ctx, 1);
  gpgme_set_passphrase_cb (gpgme_ctx, &passphrase_cb, NULL);
  gpgme_data_new_from_mem (&gpgme_data_in, "test", 5, 0);
  gpgme_data_new (&gpgme_data_out);
  gpgme_op_sign gpgme_data_out, GPGME_SIG_MODE_CLEAR);
  gpgme_data_release (gpgme_data_out);
  gpgme_data_release (gpgme_data_in);
  gpgme_release (gpgme_ctx);
}

as same as:


GpgmeCtx gpgme_ctx;
gpgme_new (&gpgme_ctx);
gpgme_set_textmode (gpgme_ctx, 1);
gpgme_set_armor (gpgme_ctx, 1);
gpgme_set_passphrase_cb (gpgme_ctx, &passphrase_cb, NULL);
while (true) {

  gpgme_data_new_from_mem (&gpgme_data_in, "test", 5, 0);
  gpgme_data_new (&gpgme_data_out);
  gpgme_op_sign gpgme_data_out, GPGME_SIG_MODE_CLEAR);
  gpgme_data_release (gpgme_data_out);
  gpgme_data_release (gpgme_data_in);
}
gpgme_release (gpgme_ctx);


.. sign mesage well, but allocate memory incrementally.
What's wrong? (version 1.4.2)



More information about the Gnupg-devel mailing list