Re: PATCH: anti memleak part 3 [PeterBloomfield MindSpring com]






On 2001.10.18 12:34 Ali Akcaagac wrote:
> jo, subject says everything. please REVIEW the patch before
> applying to CVS..

Fine work, Ali!  A little leak here, a little leak there, pretty soon 
you're up to your neck in lost memory!

A couple more comments:

> diff -ruN balsa-cvs/src/main-window.c balsa/src/main-window.c
> --- balsa-cvs/src/main-window.c	Thu Oct 18 16:38:15 2001
> +++ balsa/src/main-window.c	Thu Oct 18 18:14:43 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,
>   *                         See the file AUTHORS for a list.
> @@ -1546,6 +1545,8 @@
>          }
>          list = g_list_next(list);
>      }
> +
> +    g_list_free (list);
>  }
> 
>  /* Check all mailboxes in a list
> @@ -1568,6 +1569,8 @@
> 
>          list = g_list_next(list);
>      }
> +
> +    g_list_free (list);
>  }
> 
>  /*Callback to check a mailbox in a balsa-mblist */

These `g_list_free (list)'s aren't a good idea.  The argument `list' is 
always NULL on exiting a loop like this, and `g_list_free(NULL)' is a 
no-op.  You also don't want to free the list that you've just 
traversed, because it's `balsa_app.inbox_input', and you'll be wanting 
that later!





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