[Commits] [SCM] claws branch, master, updated. 3.11.1-139-gab24ae5

mones at claws-mail.org mones at claws-mail.org
Thu Jun 18 02:16:26 CEST 2015


The branch, master has been updated
       via  ab24ae5d5022c744620046c1ab25c898d45ef507 (commit)
       via  a8e2db54e2828e3dc4e45f97af36bf0ef2bb902a (commit)
      from  aadb7d5405e67c0823a624728652c01055c837f6 (commit)

Summary of changes:
 src/plugins/archive/archiver_gtk.c |    4 +---
 src/plugins/pgpcore/sgpgme.c       |    7 +++++--
 2 files changed, 6 insertions(+), 5 deletions(-)


- Log -----------------------------------------------------------------
commit ab24ae5d5022c744620046c1ab25c898d45ef507
Author: Ricardo Mones <ricardo at mones.org>
Date:   Thu Jun 18 02:15:12 2015 +0200

    Remove unchecked realloc which is unnecessary

diff --git a/src/plugins/archive/archiver_gtk.c b/src/plugins/archive/archiver_gtk.c
index 447de79..f42181d 100644
--- a/src/plugins/archive/archiver_gtk.c
+++ b/src/plugins/archive/archiver_gtk.c
@@ -347,10 +347,8 @@ static gchar* descriptive_file_name(
 	/* ensure file name is not larger than 96 chars (max file name size
 	 * is 100 chars but reserve for .md5)
 	 */
-	if (strlen(name) > 96) {
-		name = realloc(name, 97);
+	if (strlen(name) > 96)
 		name[96] = 0;
-	}
 	
 	new_file = g_strconcat(p, "/", name, NULL);
 

commit a8e2db54e2828e3dc4e45f97af36bf0ef2bb902a
Author: Ricardo Mones <ricardo at mones.org>
Date:   Thu Jun 18 02:13:28 2015 +0200

    Fix leak on failing realloc

diff --git a/src/plugins/pgpcore/sgpgme.c b/src/plugins/pgpcore/sgpgme.c
index 4b09d9c..bd14362 100644
--- a/src/plugins/pgpcore/sgpgme.c
+++ b/src/plugins/pgpcore/sgpgme.c
@@ -979,11 +979,14 @@ void *sgpgme_data_release_and_get_mem(gpgme_data_t data, size_t *len)
 	/* I know it's deprecated, but we don't compile with _LARGEFILE */
 	cm_gpgme_data_rewind(data);
 	while ((r = gpgme_data_read(data, buf, BUFSIZ)) > 0) {
-		result = realloc(result, r + w);
-		if (result == NULL) {
+		void *rresult = realloc(result, r + w);
+		if (rresult == NULL) {
 			g_warning("can't allocate memory\n");
+			if (result != NULL)
+				free(result);
 			return NULL;
 		}
+		result = rresult;
 		memcpy(result+w, buf, r);
 		w += r;
 	}

-----------------------------------------------------------------------


hooks/post-receive
-- 
Claws Mail


More information about the Commits mailing list