Return-Path: Delivered-To: apmail-httpd-dev-archive@www.apache.org Received: (qmail 12038 invoked from network); 4 Nov 2005 08:17:46 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 4 Nov 2005 08:17:46 -0000 Received: (qmail 45193 invoked by uid 500); 4 Nov 2005 08:17:45 -0000 Delivered-To: apmail-httpd-dev-archive@httpd.apache.org Received: (qmail 44370 invoked by uid 500); 4 Nov 2005 08:17:42 -0000 Mailing-List: contact dev-help@httpd.apache.org; run by ezmlm Precedence: bulk Reply-To: dev@httpd.apache.org list-help: list-unsubscribe: List-Post: List-Id: Delivered-To: mailing list dev@httpd.apache.org Received: (qmail 44359 invoked by uid 99); 4 Nov 2005 08:17:42 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 04 Nov 2005 00:17:42 -0800 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: domain of xuekun.hu@gmail.com designates 64.233.162.199 as permitted sender) Received: from [64.233.162.199] (HELO zproxy.gmail.com) (64.233.162.199) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 04 Nov 2005 00:17:37 -0800 Received: by zproxy.gmail.com with SMTP id v1so347358nzb for ; Fri, 04 Nov 2005 00:17:21 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=pQfEtYZvlR8e7m/FQ6+YccaE4JXwFE2GcuD6CvFs/DNV6xRnwvITMU8n9lJ3o3pOY+EHqaZEbKXokaNoYe+l2/0YpxbBzmOcPk0Z5FX6GDb5OyVgzaxOK2yKRDw9zbUnosFlFowPC+/HGpDdvrx4+OEd2BLY9OQdA0AdqfM/rmw= Received: by 10.36.96.11 with SMTP id t11mr515026nzb; Fri, 04 Nov 2005 00:17:20 -0800 (PST) Received: by 10.36.46.4 with HTTP; Fri, 4 Nov 2005 00:17:20 -0800 (PST) Message-ID: <398d69300511040017t5af86450ub8d35888fa1935d@mail.gmail.com> Date: Fri, 4 Nov 2005 16:17:20 +0800 From: Xuekun Hu To: dev@httpd.apache.org, bill@wstoddard.com Subject: Re: Potential memory leak in /modules/cache/mod_mem_cache.c In-Reply-To: <436933DE.6030307@wstoddard.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <436933DE.6030307@wstoddard.com> X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N So, same reason. Also in file mod_mem_cache.c around line 786, there is a malloc(mobj->m_len), and a few lines later, another malloc(obj->count) is performed. If the second malloc fails, I think also should add something like free(mobj->m); mobj->m =3D NULL; reasonable? Thx, Xuekun On 11/3/05, Bill Stoddard wrote: > Christophe Jaillet wrote: > > Comments agains httpd-2.1.8-beta > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > > > > In file mod_mem_cache.c (/modules/cache) around line 558, there is a ma= lloc > > (*obj). > > A few lines later, another malloc (buf) is performed. > > > > If the second malloc fails, then we have (*obj =3D NULL) but I don't se= e > > anyway to free the memory allocated. > > I would have imagined something like > > free (*obj); > > *obj =3D NULL; > > > > Unless, as a newbie in apache, there is something I don't know about me= mory > > management in apache... > > > > Christophe JAILLET > > > > Agreed, looks like a bug and your fix looks right. > > Bill > >