httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Xuekun Hu <xuekun...@gmail.com>
Subject Re: Potential memory leak in /modules/cache/mod_mem_cache.c
Date Fri, 04 Nov 2005 08:17:20 GMT
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 = NULL;

reasonable?

Thx, Xuekun

On 11/3/05, Bill Stoddard <bill@wstoddard.com> wrote:
> Christophe Jaillet wrote:
> > Comments agains httpd-2.1.8-beta
> > =================================
> >
> > In file mod_mem_cache.c (/modules/cache) around line 558, there is a malloc
> > (*obj).
> > A few lines later, another malloc (buf) is performed.
> >
> > If the second malloc fails, then we have (*obj = NULL) but I don't see
> > anyway to free the memory allocated.
> > I would have imagined something like
> > free (*obj);
> > *obj = NULL;
> >
> > Unless, as a newbie in apache, there is something I don't know about memory
> > management in apache...
> >
> > Christophe JAILLET
> >
>
> Agreed, looks like a bug and your fix looks right.
>
> Bill
>
>

Mime
View raw message