[Commits] [SCM] claws branch, master, updated. 3.18.0-111-g6cca74bc3

jonathan at claws-mail.org jonathan at claws-mail.org
Sun Sep 12 11:16:15 CEST 2021


The branch, master has been updated
       via  6cca74bc3009ced8621a17c789bf0193f4a78399 (commit)
       via  98393c3a51f9f182cfefa73a312cf1d42280dd43 (commit)
      from  8ef8b8a42a941f07f0e6b61aee167b853fd16f4c (commit)

Summary of changes:
 src/plugins/rssyl/claws.def                   |  1 -
 src/plugins/rssyl/libfeed/feed.c              |  5 ++---
 src/plugins/rssyl/libfeed/feeditem.c          |  2 +-
 src/plugins/rssyl/libfeed/feeditemenclosure.c |  2 +-
 src/plugins/rssyl/libfeed/parser.c            | 14 ++++++--------
 src/plugins/rssyl/libfeed/parser_opml.c       |  2 +-
 src/plugins/rssyl/rssyl.c                     |  2 --
 src/plugins/rssyl/rssyl_cb_menu.c             |  2 +-
 src/plugins/rssyl/rssyl_parse_feed.c          |  2 +-
 src/plugins/rssyl/strutils.c                  |  4 ++--
 10 files changed, 15 insertions(+), 21 deletions(-)


- Log -----------------------------------------------------------------
commit 6cca74bc3009ced8621a17c789bf0193f4a78399
Author: Jonathan Boeing <jonathan at claws-mail.org>
Date:   Sat Sep 11 21:28:13 2021 -0700

    match glib allocate and free functions
    
    fix allocate/free mismatches and switch to glib functions

diff --git a/src/plugins/rssyl/libfeed/feed.c b/src/plugins/rssyl/libfeed/feed.c
index ceb14bf8f..56f693ac5 100644
--- a/src/plugins/rssyl/libfeed/feed.c
+++ b/src/plugins/rssyl/libfeed/feed.c
@@ -35,8 +35,7 @@ Feed *feed_new(gchar *url)
 
 	g_return_val_if_fail(url != NULL, NULL);
 
-	feed = malloc( sizeof(Feed) );
-	g_return_val_if_fail(feed != NULL, NULL);
+	feed = g_malloc( sizeof(Feed) );
 
 	feed->is_valid = TRUE;
 	feed->timeout = FEED_DEFAULT_TIMEOUT;
@@ -263,7 +262,7 @@ guint feed_update(Feed *feed, time_t last_update)
 	g_return_val_if_fail(eh != NULL, FEED_ERR_INIT);
 
 	/* Curl initialized, create parser context now. */
-	feed_ctx = malloc( sizeof(FeedParserCtx) );
+	feed_ctx = g_malloc( sizeof(FeedParserCtx) );
 
 	feed_ctx->parser = XML_ParserCreate(NULL);
 	feed_ctx->depth = 0;
diff --git a/src/plugins/rssyl/libfeed/feeditem.c b/src/plugins/rssyl/libfeed/feeditem.c
index 8d9faaa07..d766cdcdc 100644
--- a/src/plugins/rssyl/libfeed/feeditem.c
+++ b/src/plugins/rssyl/libfeed/feeditem.c
@@ -36,7 +36,7 @@ FeedItem *feed_item_new(Feed *feed)
 {
 	FeedItem *item = NULL;
 
-	item = malloc( sizeof(FeedItem) );
+	item = g_malloc( sizeof(FeedItem) );
 	item->url = NULL;
 	item->title = NULL;
 	item->title_format = 0;
diff --git a/src/plugins/rssyl/libfeed/feeditemenclosure.c b/src/plugins/rssyl/libfeed/feeditemenclosure.c
index 7f5596164..0716003d6 100644
--- a/src/plugins/rssyl/libfeed/feeditemenclosure.c
+++ b/src/plugins/rssyl/libfeed/feeditemenclosure.c
@@ -32,7 +32,7 @@ FeedItemEnclosure *feed_item_enclosure_new(gchar *url, gchar *type, gulong size)
 	g_return_val_if_fail(type != NULL, NULL);
 	g_return_val_if_fail(size > 0, NULL);
 
-	enclosure = malloc( sizeof(FeedItemEnclosure) );
+	enclosure = g_malloc( sizeof(FeedItemEnclosure) );
 	enclosure->url = g_strdup(url);
 	enclosure->type = g_strdup(type);
 	enclosure->size = size;
diff --git a/src/plugins/rssyl/libfeed/parser.c b/src/plugins/rssyl/libfeed/parser.c
index 02603a048..e824b8365 100644
--- a/src/plugins/rssyl/libfeed/parser.c
+++ b/src/plugins/rssyl/libfeed/parser.c
@@ -120,9 +120,7 @@ void libfeed_expat_chparse(void *data, const gchar *s, gint len)
 	gchar *buf = NULL;
 	gint i, xblank = 1;
 
-	buf = malloc(len+1);
-	strncpy(buf, s, len);
-	buf[len] = '\0';
+	buf = g_strndup(s, len);
 
 	/* check if the string is blank, ... */
 	for( i = 0; i < strlen(buf); i++ )
@@ -336,9 +334,9 @@ static void feed_parser_unknown_encoding_data_free(void *data)
 	struct FeedParserUnknownEncoding *enc_data;
 
 	enc_data = data;
-	free(enc_data->charset);
+	g_free(enc_data->charset);
 	g_iconv_close(enc_data->cd);
-	free(enc_data);
+	g_free(enc_data);
 }
 
 int feed_parser_unknown_encoding_handler(void *encdata, const XML_Char *name,
@@ -360,15 +358,15 @@ int feed_parser_unknown_encoding_handler(void *encdata, const XML_Char *name,
 	if( cd == (GIConv)-1 )
 		return XML_STATUS_ERROR;
 
-	data = malloc( sizeof(*data) );
+	data = g_malloc( sizeof(*data) );
 	if( data == NULL ) {
 		g_iconv_close(cd);
 		return XML_STATUS_ERROR;
 	}
 
-	data->charset = strdup(name);
+	data->charset = g_strdup(name);
 	if( data->charset == NULL ) {
-		free(data);
+		g_free(data);
 		g_iconv_close(cd);
 		return XML_STATUS_ERROR;
 	}
diff --git a/src/plugins/rssyl/libfeed/parser_opml.c b/src/plugins/rssyl/libfeed/parser_opml.c
index dc31980bd..4e3484141 100644
--- a/src/plugins/rssyl/libfeed/parser_opml.c
+++ b/src/plugins/rssyl/libfeed/parser_opml.c
@@ -85,7 +85,7 @@ void opml_process(gchar *path, OPMLProcessFunc function, gpointer data)
 	gint status, err;
 
 	/* Initialize our context */
-	ctx = malloc( sizeof(OPMLProcessCtx) );
+	ctx = g_malloc( sizeof(OPMLProcessCtx) );
 	ctx->parser = XML_ParserCreate(NULL);
 	ctx->depth = 0;
 	ctx->str = NULL;
diff --git a/src/plugins/rssyl/rssyl_cb_menu.c b/src/plugins/rssyl/rssyl_cb_menu.c
index a527bf7b8..da91c9afe 100644
--- a/src/plugins/rssyl/rssyl_cb_menu.c
+++ b/src/plugins/rssyl/rssyl_cb_menu.c
@@ -365,7 +365,7 @@ void rssyl_import_feed_list_cb(GtkAction *action, gpointer data)
 	g_return_if_fail(item != NULL);
 	g_return_if_fail(item->folder != NULL);
 
-	ctx = malloc( sizeof(OPMLImportCtx) );
+	ctx = g_malloc( sizeof(OPMLImportCtx) );
 	ctx->failures = 0;
 	ctx->depth = rssyl_folder_depth(item) + 1;
 	ctx->current = NULL;
diff --git a/src/plugins/rssyl/rssyl_parse_feed.c b/src/plugins/rssyl/rssyl_parse_feed.c
index b7a49ddc7..bc6a47a1e 100644
--- a/src/plugins/rssyl/rssyl_parse_feed.c
+++ b/src/plugins/rssyl/rssyl_parse_feed.c
@@ -96,7 +96,7 @@ static void rssyl_expire_items(RFolderItem *ritem, Feed *feed)
 	g_return_if_fail(ritem->items != NULL);
 	g_return_if_fail(feed != NULL);
 
-	ctx = malloc( sizeof(RSSylExpireItemsCtx) );
+	ctx = g_malloc( sizeof(RSSylExpireItemsCtx) );
 	ctx->expired_ids = NULL;
 
 	/* Check each locally stored item, if it is still in the upstream
diff --git a/src/plugins/rssyl/strutils.c b/src/plugins/rssyl/strutils.c
index eb15b75cd..d60fc5f13 100644
--- a/src/plugins/rssyl/strutils.c
+++ b/src/plugins/rssyl/strutils.c
@@ -70,7 +70,7 @@ gchar *rssyl_strreplace(gchar *source, gchar *pattern,
 		- ( count * len_pattern )
 		+ ( count * len_replacement );
 
-	new = malloc(final_length + 1);
+	new = g_malloc(final_length + 1);
 	memset(new, '\0', final_length + 1);
 
 	/* 'c' will be our iterator over original string
@@ -195,7 +195,7 @@ static gchar *rssyl_sanitize_string(gchar *str, gboolean strip_nl)
 	if( str == NULL )
 		return NULL;
 
-	n = new = malloc(strlen(str) + 1);
+	n = new = g_malloc(strlen(str) + 1);
 	memset(new, '\0', strlen(str) + 1);
 
 	while( *c != '\0' ) {

commit 98393c3a51f9f182cfefa73a312cf1d42280dd43
Author: Jonathan Boeing <jonathan at claws-mail.org>
Date:   Sat Sep 11 19:08:56 2021 -0700

    Fix crash when unloading RSSyl plugin
    
    Bug 4467
    
    folder is not a LocalFolder, so calling folder_local_folder_destroy() passes
    a bad address to g_free().  Causes a potential crash on Windows, and valgrind
    logs an 'Invalid read of size 8' and 'Invalid free() / delete / delete[] /
    realloc()'

diff --git a/src/plugins/rssyl/claws.def b/src/plugins/rssyl/claws.def
index a36841d42..d3da832fc 100644
--- a/src/plugins/rssyl/claws.def
+++ b/src/plugins/rssyl/claws.def
@@ -54,7 +54,6 @@ folder_item_search_msgs_local
 folder_item_set_xml
 folder_item_update_freeze
 folder_item_update_thaw
-folder_local_folder_destroy
 folder_local_name_ok
 folder_new
 folder_register_class
diff --git a/src/plugins/rssyl/rssyl.c b/src/plugins/rssyl/rssyl.c
index bb1ea4f9c..3a9517dcd 100644
--- a/src/plugins/rssyl/rssyl.c
+++ b/src/plugins/rssyl/rssyl.c
@@ -32,7 +32,6 @@
 /* Claws Mail includes */
 #include <folder.h>
 #include <procmsg.h>
-#include <localfolder.h>
 #include <main.h>
 #include <mh.h>
 #include <xml.h>
@@ -259,7 +258,6 @@ static Folder *rssyl_new_folder(const gchar *name, const gchar *path)
 
 static void rssyl_destroy_folder(Folder *folder)
 {
-	folder_local_folder_destroy(LOCAL_FOLDER(folder));
 }
 
 static void rssyl_item_set_xml(Folder *folder, FolderItem *item, XMLTag *tag)

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


hooks/post-receive
-- 
Claws Mail


More information about the Commits mailing list