Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 18 Sep 1995 10:43:12 +0200 (MET DST)
From:      Christoph Kukulies <kuku@gilberto.physik.RWTH-Aachen.DE>
To:        julian@freefall.freebsd.org (Julian Elischer)
Cc:        hackers@freefall.freebsd.org
Subject:   Re: why is this not a bug in namei?
Message-ID:  <199509180843.KAA08948@gilberto.physik.RWTH-Aachen.DE>
In-Reply-To: <199509180640.XAA05368@freefall.freebsd.org> from "Julian Elischer" at Sep 17, 95 11:40:19 pm

next in thread | previous in thread | raw e-mail | index | archive | help
> 
> 
>         if ((cnp->cn_flags & HASBUF) == 0)
>                 MALLOC(cnp->cn_pnbuf, caddr_t, MAXPATHLEN, M_NAMEI, M_WAITOK);
> [....]
> 
>         if (error) {
>                 free(cnp->cn_pnbuf, M_NAMEI);
                  ^^^^
Is this just a typo? Shouldn't it be a FREE() macro like below?

>                 ndp->ni_vp = NULL;
>                 return (error);
> [...]
>                 if (error) {
>                         FREE(cnp->cn_pnbuf, M_NAMEI);
>                         return (error);
> [....] (and more confusingly)
>                 if ((cnp->cn_flags & ISSYMLINK) == 0) {
>                         if ((cnp->cn_flags & (SAVENAME | SAVESTART)) == 0)
>                                 FREE(cnp->cn_pnbuf, M_NAMEI);
>                         else
>                                 cnp->cn_flags |= HASBUF;
>                         return (0);
>                 }
> [....]
>         FREE(cnp->cn_pnbuf, M_NAMEI);
> }                       
> 
> if HASBUF was set, we have freed something we didn't allocate..
> (whenever we get an error, by the looks of it..)
> 
> luckily I can't actually see anywhere that HASBUF is used
> (can anyone?) but it looks wrong to me...
> 
> 
> 
> julian
> 

--Chris Christoph P. U. Kukulies kuku@gil.physik.rwth-aachen.de



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199509180843.KAA08948>