[gmime] Fixed memory leaks in gpg decryption
- From: Jeffrey Stedfast <fejj src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gmime] Fixed memory leaks in gpg decryption
- Date: Wed, 12 Sep 2012 14:05:18 +0000 (UTC)
commit 1bacd43b50d91bd03a4ae1dc9f46f5783dee61b1
Author: Jeffrey Stedfast <fejj gnome org>
Date: Wed Sep 12 10:04:39 2012 -0400
Fixed memory leaks in gpg decryption
2012-09-12 Jeffrey Stedfast <jeff xamarin com>
* gmime/gmime-gpg-context.c (gpg_ctx_parse_status): Unref the
certificate after adding it to the list (adding it to the list
refs it).
* gmime/gmime-multipart-encrypted.c
(g_mime_multipart_encrypted_decrypt): If the 'result' out param is
null, unref the GMimeDecryptResult to avoid leaking.
ChangeLog | 10 ++++++++++
gmime/gmime-gpg-context.c | 2 ++
gmime/gmime-multipart-encrypted.c | 4 +++-
3 files changed, 15 insertions(+), 1 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 5b251ad..d05dcb1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2012-09-12 Jeffrey Stedfast <jeff xamarin com>
+
+ * gmime/gmime-gpg-context.c (gpg_ctx_parse_status): Unref the
+ certificate after adding it to the list (adding it to the list
+ refs it).
+
+ * gmime/gmime-multipart-encrypted.c
+ (g_mime_multipart_encrypted_decrypt): If the 'result' out param is
+ null, unref the GMimeDecryptResult to avoid leaking.
+
2012-08-13 Jeffrey Stedfast <jeff xamarin com>
* gmime/gmime-utils.c (tokenize_rfc2047_phrase): Don't forget to
diff --git a/gmime/gmime-gpg-context.c b/gmime/gmime-gpg-context.c
index 860452e..c520f86 100644
--- a/gmime/gmime-gpg-context.c
+++ b/gmime/gmime-gpg-context.c
@@ -1312,9 +1312,11 @@ gpg_ctx_parse_status (struct _GpgCtx *gpg, GError **err)
cert->pubkey_algo = strtoul (status, &inend, 10);
if (inend == status || *inend != ' ') {
cert->pubkey_algo = 0;
+ g_object_unref (cert);
break;
}
+ g_object_unref (cert);
status = inend + 1;
/* third token is a dummy value which is always '0' */
diff --git a/gmime/gmime-multipart-encrypted.c b/gmime/gmime-multipart-encrypted.c
index e3d0913..0cd3df3 100644
--- a/gmime/gmime-multipart-encrypted.c
+++ b/gmime/gmime-multipart-encrypted.c
@@ -396,7 +396,9 @@ g_mime_multipart_encrypted_decrypt (GMimeMultipartEncrypted *mpe, GMimeCryptoCon
return NULL;
}
- if (result)
+ if (!result)
+ g_object_unref (res);
+ else
*result = res;
return decrypted;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]