changeset 240:fbff73fe5b40 noffle

[svn] * src/client.c: That wasn't a memory leak fixed on Feb 8th. That was a cockup cause by my forgetting that Cont_app takes ownership of an overview. Revert it and add comment to Cont_app. Spotted with the aid of valgrind. * src/post.c,src/pseudo.c * src/util.c: Fix out of bounds write bug spotted by valgrind. * src/database.c: Fix minor memory leak spotted by valgrind. Valgrind is at http://devel-home.kde.org/~sewardj/.
author bears
date Tue, 26 Feb 2002 17:13:31 +0000
parents 2b7ddb90d9b2
children d70e9dd6b308
files ChangeLog src/client.c src/database.c src/post.c src/pseudo.c src/util.c
diffstat 6 files changed, 21 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Thu Feb 14 17:17:02 2002 +0000
+++ b/ChangeLog	Tue Feb 26 17:13:31 2002 +0000
@@ -1,3 +1,14 @@
+Tue Feb 26 2002 Jim Hague <jim.hague@acm.org>
+
+* src/client.c: That wasn't a memory leak fixed on Feb 8th. That was a
+  cockup cause by my forgetting that Cont_app takes ownership of an
+  overview. Revert it and add comment to Cont_app. Spotted with the aid
+  of valgrind.
+* src/post.c,src/pseudo.c
+* src/util.c: Fix out of bounds write bug spotted by valgrind.
+* src/database.c: Fix minor memory leak spotted by valgrind.
+  Valgrind is at http://devel-home.kde.org/~sewardj/.
+	
 Thu Feb 14 2002 Jim Hague <jim.hague@acm.org>
 
 * src/over.c: Fix warning.
--- a/src/client.c	Thu Feb 14 17:17:02 2002 +0000
+++ b/src/client.c	Tue Feb 26 17:13:31 2002 +0000
@@ -1,7 +1,7 @@
 /*
   client.c
 
-  $Id: client.c 364 2002-02-08 17:06:25Z bears $
+  $Id: client.c 371 2002-02-26 17:13:31Z bears $
 */
 
 #if HAVE_CONFIG_H
@@ -1026,7 +1026,7 @@
                 del_Over( ov );
 		continue;
             }
-            Cont_app( ov );
+            Cont_app( ov );     /* Cont modules owns ov after this */
             prepareEntry( ov );
             if ( action == FILTER_FULL
 		 || ( action == FILTER_THREAD && needsMark( ref ) ) )
@@ -1034,7 +1034,6 @@
                 Req_add( client.serv, msgId );
                 ++cntMarked;
             }
-            del_Over( ov );
         }
         Grp_setRmtNext( client.grp, rmtNumb + 1 );
     }
--- a/src/database.c	Thu Feb 14 17:17:02 2002 +0000
+++ b/src/database.c	Tue Feb 26 17:13:31 2002 +0000
@@ -1,7 +1,7 @@
 /*
   database.c
 
-  $Id: database.c 316 2001-10-31 11:44:53Z bears $
+  $Id: database.c 371 2002-02-26 17:13:31Z bears $
 
   Uses GNU gdbm library. Using Berkeley db (included in libc6) was
   cumbersome. It is based on Berkeley db 1.85, which has severe bugs
@@ -606,6 +606,7 @@
 	
 	Itl_next( refs );	/* Throw away group number */
     }
+    del_Itl( refs );
 
     return res;
 }
--- a/src/post.c	Thu Feb 14 17:17:02 2002 +0000
+++ b/src/post.c	Tue Feb 26 17:13:31 2002 +0000
@@ -1,7 +1,7 @@
 /*
   post.c
 
-  $Id: post.c 342 2001-12-09 12:31:57Z bears $
+  $Id: post.c 371 2002-02-26 17:13:31Z bears $
 */
 
 #if HAVE_CONFIG_H
@@ -75,7 +75,7 @@
     msgId = article.over.msgId;
     
     Cont_read( grp );
-    Cont_app( over );
+    Cont_app( over );     /* Cont modules owns ov after this */
     Log_dbg( LOG_DBG_POST, "Added message '%s' to group '%s'.", msgId, grp );
 
     if ( !article.posted )
--- a/src/pseudo.c	Thu Feb 14 17:17:02 2002 +0000
+++ b/src/pseudo.c	Tue Feb 26 17:13:31 2002 +0000
@@ -1,7 +1,7 @@
 /*
   pseudo.c
   
-  $Id: pseudo.c 342 2001-12-09 12:31:57Z bears $
+  $Id: pseudo.c 371 2002-02-26 17:13:31Z bears $
 */
 
 #if HAVE_CONFIG_H
@@ -203,7 +203,7 @@
     ov = genOv( rawSubj, DynStr_str( body ), "PSEUDO" );
     if ( body && artTxt && ov )
     {
-        Cont_app( ov );
+        Cont_app( ov );     /* Cont modules owns ov after this */
         if ( Db_prepareEntry( ov, Cont_grp(), Cont_last() ) )
             Db_storeArt( Ov_msgId( ov ), DynStr_str( artTxt ) );
         if ( Cont_write() )
--- a/src/util.c	Thu Feb 14 17:17:02 2002 +0000
+++ b/src/util.c	Tue Feb 26 17:13:31 2002 +0000
@@ -1,7 +1,7 @@
 /*
   util.c
 
-  $Id: util.c 342 2001-12-09 12:31:57Z bears $
+  $Id: util.c 371 2002-02-26 17:13:31Z bears $
 */
 
 #if HAVE_CONFIG_H
@@ -185,7 +185,7 @@
     while ( isspace( *line ) )
         ++line;
     p = line + strlen( line ) - 1;
-    while ( isspace( *p ) )
+    while ( p >= line && isspace( *p ) )
     {
         *p = '\0';
         --p;