[asterisk-dev] [asterisk-commits] tilghman: trunk r221920 - /trunk/main/logger.c

Tilghman Lesher tlesher at digium.com
Fri Oct 2 09:29:37 CDT 2009


On Friday 02 October 2009 07:15:12 Kevin P. Fleming wrote:
> SVN commits to the Asterisk project wrote:
> > Author: tilghman
> > Date: Thu Oct  1 22:04:34 2009
> > New Revision: 221920
> >
> > URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=221920
> > Log:
> > Initialize a variable that we check immediately upon startup.
> > (closes issue #15973)
> >  Reported by: atis
> >
> > Modified:
> >     trunk/main/logger.c
> >
> > Modified: trunk/main/logger.c
> > URL:
> > http://svnview.digium.com/svn/asterisk/trunk/main/logger.c?view=diff&rev=
> >221920&r1=221919&r2=221920
> > =========================================================================
> >===== --- trunk/main/logger.c (original)
> > +++ trunk/main/logger.c Thu Oct  1 22:04:34 2009
> > @@ -139,7 +139,7 @@
> >  static AST_LIST_HEAD_STATIC(logmsgs, logmsg);
> >  static pthread_t logthread = AST_PTHREADT_NULL;
> >  static ast_cond_t logcond;
> > -static int close_logger_thread;
> > +static int close_logger_thread = 0;
>
> This should not be necessary; by specification in the C standards,
> static module-scope variables are always initialized to zero unless an
> initializer is provided. If valgrind is reporting that this variable is
> accessed without being initialized, it is in error.

Valgrind did not report that it was not initialized.  However, the log message
list had 4GB of memory allocated to it, and it was still growing.  I looked
through the code and what it appeared like to me was that the thread was
started at boot and immediately exited, thus the memory wasn't likely to ever
be freed.

-- 
Tilghman Lesher
Digium, Inc. | Senior Software Developer
twitter: Corydon76 | IRC: Corydon76-dig (Freenode)
Check us out at: www.digium.com & www.asterisk.org



More information about the asterisk-dev mailing list