[Commits] [SCM] claws branch, master, updated. 3.18.0-107-g30515cc37

wwp at claws-mail.org wwp at claws-mail.org
Sat Sep 11 23:06:56 CEST 2021


The branch, master has been updated
       via  30515cc370f03303d44b44131338434b72b29ce6 (commit)
      from  7a8bcbd2072498a7b9e0fba4a5c6a60f60d8cf85 (commit)

Summary of changes:
 src/addritem.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)


- Log -----------------------------------------------------------------
commit 30515cc370f03303d44b44131338434b72b29ce6
Author: wwp <subscript at free.fr>
Date:   Sat Sep 11 23:05:22 2021 +0200

    Fix CID 1491380: resource leak, and add few errors when allocating new
    itemFolders weren't possible (this would lead to unpredictable behaviour
    later, anyway).

diff --git a/src/addritem.c b/src/addritem.c
index 832a139fa..f0c26176a 100644
--- a/src/addritem.c
+++ b/src/addritem.c
@@ -788,6 +788,8 @@ void addritem_print_item_group( ItemGroup *group, FILE *stream ) {
 ItemFolder *addritem_create_item_folder( void ) {
 	ItemFolder *folder;
 	folder = g_new0( ItemFolder, 1 );
+	if (!folder)
+		g_error("could not create new itemFolder");
 	ADDRITEM_TYPE(folder) = ITEMTYPE_FOLDER;
 	ADDRITEM_ID(folder) = NULL;
 	ADDRITEM_NAME(folder) = NULL;
@@ -812,14 +814,14 @@ ItemFolder *addritem_create_item_folder( void ) {
  * \return A copy of the folder, or <i>NULL</i> if null argument supplied.
  */
 ItemFolder *addritem_copy_item_folder( ItemFolder *item ) {
-	ItemFolder *itemNew;
+	ItemFolder *itemNew = NULL;
 
-	itemNew = g_new0( ItemFolder, 1 );
 	if( item ) {
 		itemNew = addritem_create_item_folder();
 		ADDRITEM_NAME(itemNew) = g_strdup( ADDRITEM_NAME(item) );
 		itemNew->folderType = item->folderType;
-	}
+	} else
+		g_error("could not create a copy of a null itemFolder");
 	return itemNew;
 }
 

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


hooks/post-receive
-- 
Claws Mail


More information about the Commits mailing list