[Commits] [SCM] claws branch, master, updated. 3.18.0-266-g3a0ac9efa

wwp at claws-mail.org wwp at claws-mail.org
Thu Oct 7 09:52:40 CEST 2021


The branch, master has been updated
       via  3a0ac9efa8f8696a924480bcfb34e28bc5bcae7a (commit)
       via  502474a0d4b00ecc461e82042f853fef06fc858c (commit)
      from  68b65ac49c4d51ef855fd65e2a9206e528190a82 (commit)

Summary of changes:
 src/ldif.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)


- Log -----------------------------------------------------------------
commit 3a0ac9efa8f8696a924480bcfb34e28bc5bcae7a
Author: wwp <subscript at free.fr>
Date:   Thu Oct 7 09:52:13 2021 +0200

    Fix CID 1491058: resource leak (a good old one).

diff --git a/src/ldif.c b/src/ldif.c
index 5b956d452..6f686590f 100644
--- a/src/ldif.c
+++ b/src/ldif.c
@@ -239,7 +239,7 @@ static void ldif_close_file( LdifFile *ldifFile ) {
 /**
  * Read line of text from file.
  * \param  ldifFile LDIF import control object.
- * \return ptr to buffer where line starts.
+ * \return ptr to buffer where line starts (must be freed by caller).
  */
 static gchar *ldif_get_line( LdifFile *ldifFile ) {
 	gchar *buf = g_malloc(LDIFBUFSIZE);
@@ -279,8 +279,7 @@ static gchar *ldif_get_line( LdifFile *ldifFile ) {
 	}
 	buf[i] = '\0';
 
-	/* Return a copy of buffer */
-	return g_strdup( buf );
+	return buf;
 }
 
 /**

commit 502474a0d4b00ecc461e82042f853fef06fc858c
Author: wwp <subscript at free.fr>
Date:   Thu Oct 7 09:30:52 2021 +0200

    Free ptr only if necessary (around CID 1491058).

diff --git a/src/ldif.c b/src/ldif.c
index a7761f21d..5b956d452 100644
--- a/src/ldif.c
+++ b/src/ldif.c
@@ -714,8 +714,8 @@ static void ldif_read_file( LdifFile *ldifFile, AddressCache *cache ) {
 					g_free( tagName );
 				}
 			}
+			g_free( line );
 		}
-		g_free( line );
 	}
 
 	/* Release data */
@@ -889,8 +889,8 @@ static void ldif_read_tag_list( LdifFile *ldifFile ) {
 					}
 				}
 			}
+			g_free( line );
 		}
-		g_free( line );
 	}
 
 	/* Release data */

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


hooks/post-receive
-- 
Claws Mail


More information about the Commits mailing list