* lib/mu-msg-crypto: correct mem handling (after discussion with gmime dev)
This commit is contained in:
@ -361,6 +361,7 @@ mu_msg_crypto_decrypt_part (GMimeMultipartEncrypted *enc, MuMsgOptions opts,
|
|||||||
{
|
{
|
||||||
GMimeObject *dec;
|
GMimeObject *dec;
|
||||||
GMimeCryptoContext *ctx;
|
GMimeCryptoContext *ctx;
|
||||||
|
GMimeDecryptResult *res;
|
||||||
|
|
||||||
g_return_val_if_fail (GMIME_IS_MULTIPART_ENCRYPTED(enc), NULL);
|
g_return_val_if_fail (GMIME_IS_MULTIPART_ENCRYPTED(enc), NULL);
|
||||||
|
|
||||||
@ -371,8 +372,20 @@ mu_msg_crypto_decrypt_part (GMimeMultipartEncrypted *enc, MuMsgOptions opts,
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
dec = g_mime_multipart_encrypted_decrypt (enc, ctx, NULL, err);
|
/* at the time of writing, there is a small leak in
|
||||||
|
* g_mime_multipart_encrypted_decrypt; I've notified its
|
||||||
|
* author and it has been fixed 2012-09-12:
|
||||||
|
* http://git.gnome.org/browse/gmime/commit/
|
||||||
|
* ?id=1bacd43b50d91bd03a4ae1dc9f46f5783dee61b1 */
|
||||||
|
res = NULL;
|
||||||
|
dec = g_mime_multipart_encrypted_decrypt (enc, ctx, &res, err);
|
||||||
g_object_unref (ctx);
|
g_object_unref (ctx);
|
||||||
|
|
||||||
|
/* we don't use the 3rd param 'res' * (GMimeDecryptResult),
|
||||||
|
* but we must unref it. */
|
||||||
|
if (res)
|
||||||
|
g_object_unref (res);
|
||||||
|
|
||||||
if (!dec) {
|
if (!dec) {
|
||||||
if (err && !*err)
|
if (err && !*err)
|
||||||
mu_util_g_set_error (err, MU_ERROR_CRYPTO,
|
mu_util_g_set_error (err, MU_ERROR_CRYPTO,
|
||||||
|
|||||||
Reference in New Issue
Block a user