[gmime/gmime-2-4] Don't unref encrypted part on error



commit d5c8e09a655d15e22bb1134a3e7eade28a2d16ef
Author: Jeffrey Stedfast <fejj gnome org>
Date:   Sun Jun 20 10:50:40 2010 -0400

    Don't unref encrypted part on error
    
    2010-06-20  Jeffrey Stedfast  <fejj novell com>
    
    	* gmime/gmime-multipart-encrypted.c
    	* (g_mime_multipart_encrypted_decrypt):
    	Don't unref the encrypted content mime part object when the
    	content-type doesn't match application/octet-stream,
    	g_mime_multipart_get_part() does not ref parts it returns. We
    also
    	need to set an error when this happens.

 ChangeLog                         |   10 +++++++++-
 gmime/gmime-multipart-encrypted.c |    4 +++-
 2 files changed, 12 insertions(+), 2 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 1c8311a..2732f71 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,8 +1,16 @@
+2010-06-20  Jeffrey Stedfast  <fejj novell com>
+
+	* gmime/gmime-multipart-encrypted.c (g_mime_multipart_encrypted_decrypt):
+	Don't unref the encrypted content mime part object when the
+	content-type doesn't match application/octet-stream,
+	g_mime_multipart_get_part() does not ref parts it returns. We also
+	need to set an error when this happens.
+
 2010-05-18  Jeffrey Stedfast  <fejj novell com>
 
 	* README: Bumped version
 
-	* configure.in: Bumped version to 2.4.16
+	* configure.in: Bumped version to 2.4.17
 
 	* build/vs2008/gmime.vcproj: Bumped version.
 
diff --git a/gmime/gmime-multipart-encrypted.c b/gmime/gmime-multipart-encrypted.c
index c4e41d0..e995f45 100644
--- a/gmime/gmime-multipart-encrypted.c
+++ b/gmime/gmime-multipart-encrypted.c
@@ -386,7 +386,9 @@ g_mime_multipart_encrypted_decrypt (GMimeMultipartEncrypted *mpe, GMimeCipherCon
 	encrypted = g_mime_multipart_get_part (GMIME_MULTIPART (mpe), GMIME_MULTIPART_ENCRYPTED_CONTENT);
 	mime_type = g_mime_object_get_content_type (encrypted);
 	if (!g_mime_content_type_is_type (mime_type, "application", "octet-stream")) {
-		g_object_unref (encrypted);
+		g_set_error (err, GMIME_ERROR, GMIME_ERROR_PROTOCOL_ERROR,
+			     "Failed to decrypt MIME part: unexpected content type");
+		
 		return NULL;
 	}
 	



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]