PATCH: anti memleak part 4



oki, the last one for today.. i am getting bored now..
hope that everything is correct so far. so please review
and commit... it took me a while to do all this hope it
wasnt for /dev/null :)

-- 
Name....: Ali Akcaagac
Status..: Student Of Computer & Economic Science
E-Mail..: mailto:ali.akcaagac@stud.fh-wilhelmshaven.de
WWW.....: http://www.fh-wilhelmshaven.de/~akcaagaa
diff -ruN balsa-cvs/libbalsa/mime.c balsa/libbalsa/mime.c
--- balsa-cvs/libbalsa/mime.c	Thu Oct 18 16:38:17 2001
+++ balsa/libbalsa/mime.c	Thu Oct 18 18:54:25 2001
@@ -1,5 +1,4 @@
 /* -*-mode:c; c-style:k&r; c-basic-offset:4; -*- */
-/* vim:set ts=4 sw=4 ai et: */
 /* Balsa E-Mail Client
  *
  * Copyright (C) 1997-2000 Stuart Parmenter and others,
diff -ruN balsa-cvs/libbalsa/misc.c balsa/libbalsa/misc.c
--- balsa-cvs/libbalsa/misc.c	Thu Oct 18 16:38:17 2001
+++ balsa/libbalsa/misc.c	Thu Oct 18 18:53:47 2001
@@ -1,5 +1,4 @@
 /* -*-mode:c; c-style:k&r; c-basic-offset:4; -*- */
-/* vim:set ts=4 sw=4 ai et: */
 /* Balsa E-Mail Client
  *
  * Copyright (C) 1997-2001 Stuart Parmenter and others,
diff -ruN balsa-cvs/libbalsa/pop3.c balsa/libbalsa/pop3.c
--- balsa-cvs/libbalsa/pop3.c	Thu Oct 18 16:38:17 2001
+++ balsa/libbalsa/pop3.c	Thu Oct 18 18:59:33 2001
@@ -149,9 +149,15 @@
         finish = strchr(start, '>');
         if (finish) {
             strncpy(stamp, start, finish - start + 1);
-            return TRUE;
+
+	    g_free(start);
+	    g_free(finish);
+	    return TRUE;
         }
+
+	g_free(start);
     } 
+
     return FALSE;
 }
 
@@ -402,7 +408,7 @@
     static const int GUI_PROGRESS_STEP = 2048;
     int last_update_size = 0;
     char threadbuf[160];
-    
+
     sprintf(threadbuf, _("Retrieving Message %d of %d"), msgno, msgs);
     prog_cb ( threadbuf, 0, 0);
 #endif
@@ -410,9 +416,9 @@
     DM("POP3: fetching message %d", msgno);
     /* Now read the actual message. */
     while(1) {
-	char *p;
+	char *p = NULL;
 	int chunk;
-	
+
 	if ((chunk = getLine (s, buffer, sizeof (buffer))) == -1) 
 	    return POP_CONN_ERR;
 #ifdef BALSA_USE_THREADS
@@ -430,14 +436,14 @@
 		/* end of message */
 		break; /* while look */
 	    }
-	    
+
 	    *num_bytes += chunk;
-	    
+
 	    /* change CRLF to just LF */
 	    buffer[chunk-2] = '\n';
 	    buffer[chunk-1] = 0;
 	    chunk--;
-	    
+
 	    /* see if the line was byte-stuffed */
 	    if (buffer[0] == '.')  {
 		p = buffer + 1;
@@ -448,12 +454,15 @@
 	}
 	else
 	    p = buffer;
-	
+
 	/* fwrite(p, 1, chunk, stdout); */
 	if(fwrite (p, 1, (size_t) chunk, msg) != (size_t) chunk)
             return POP_WRITE_ERR;
+
+	if(p != NULL)
+	    g_free(p);
     } /* end of while */
-    
+
     DM("POP3: Message %d retrieved", msgno);
     return POP_OK;
 }
diff -ruN balsa-cvs/libbalsa/send.c balsa/libbalsa/send.c
--- balsa-cvs/libbalsa/send.c	Thu Oct 18 16:38:17 2001
+++ balsa/libbalsa/send.c	Thu Oct 18 18:43:57 2001
@@ -1,5 +1,4 @@
 /* -*-mode:c; c-style:k&r; c-basic-offset:4; -*- */
-/* vim:set ts=4 sw=4 ai et: */
 /* Balsa E-Mail Client
  *
  * Copyright (C) 1997-2001 Stuart Parmenter and others,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]