Return-Path: Delivered-To: apmail-ws-axis-c-dev-archive@www.apache.org Received: (qmail 64778 invoked from network); 14 Apr 2004 04:22:17 -0000 Received: from daedalus.apache.org (HELO mail.apache.org) (208.185.179.12) by minotaur-2.apache.org with SMTP; 14 Apr 2004 04:22:17 -0000 Received: (qmail 27775 invoked by uid 500); 14 Apr 2004 04:21:56 -0000 Delivered-To: apmail-ws-axis-c-dev-archive@ws.apache.org Received: (qmail 27712 invoked by uid 500); 14 Apr 2004 04:21:56 -0000 Mailing-List: contact axis-c-dev-help@ws.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: list-post: List-Id: "Apache AXIS C Developers List" Reply-To: "Apache AXIS C Developers List" Delivered-To: mailing list axis-c-dev@ws.apache.org Received: (qmail 27698 invoked from network); 14 Apr 2004 04:21:56 -0000 Received: from unknown (HELO web40612.mail.yahoo.com) (66.218.78.149) by daedalus.apache.org with SMTP; 14 Apr 2004 04:21:56 -0000 Message-ID: <20040414042207.43998.qmail@web40612.mail.yahoo.com> Received: from [129.34.20.19] by web40612.mail.yahoo.com via HTTP; Tue, 13 Apr 2004 21:22:07 PDT Date: Tue, 13 Apr 2004 21:22:07 -0700 (PDT) From: Samisa Abeysinghe Subject: Re: AxisConfig Memory leaks - patch To: Apache AXIS C Developers List In-Reply-To: <20040414033517.35639.qmail@web40612.mail.yahoo.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N Hi All, If I am to detail a bit about this patch... One C++ best practice is to match malloc() with free() and new with delete. Please do not mix malloc() and delete. In AxisConfig.cpp, the opened file is never closed. Also the variable 'key' is malloc()ed but never freed. The patch fix those problems. Thanks, Samisa... --- Samisa Abeysinghe wrote: > diff -u ../../original/ws-axis/c/src/common/AxisConfig.cpp src/common/AxisConfig.cpp > --- ../../original/ws-axis/c/src/common/AxisConfig.cpp 2004-04-07 18:59:25.000000000 +0600 > +++ src/common/AxisConfig.cpp 2004-04-14 09:29:29.000000000 +0600 > @@ -38,13 +38,16 @@ > AxisConfig::~AxisConfig () > { > if (m_sWsddFilePath) > - delete m_sWsddFilePath; > + //delete m_sWsddFilePath; > + free(m_sWsddFilePath); > if (m_sAxisLogPath) > - delete m_sAxisLogPath; > + //delete m_sAxisLogPath; > + free(m_sAxisLogPath); > if (m_sClientWsddFilePath) > delete m_sClientWsddFilePath; > if (m_sAxisHome) > - delete m_sAxisHome; > + //delete m_sAxisHome; > + free(m_sAxisHome); > if (m_sValue) > delete m_sValue; > } > @@ -100,8 +103,11 @@ > linesize - strlen (key) - 2); > m_sClientWsddFilePath[linesize - strlen (key) - 2] = '\0'; > } > + free(key); > } > > + fclose(fileConfig); > + > > return AXIS_SUCCESS; > } > > > > > > __________________________________ > Do you Yahoo!? > Yahoo! Tax Center - File online by April 15th > http://taxes.yahoo.com/filing.html __________________________________ Do you Yahoo!? Yahoo! Tax Center - File online by April 15th http://taxes.yahoo.com/filing.html