Re: [AMBER-Developers] bug in ptraj.c (AmberTools 1.3)

From: Hannes Loeffler <Hannes.Loeffler.stfc.ac.uk>
Date: Tue, 23 Feb 2010 16:16:02 +0000

On Tue, 23 Feb 2010 10:32:03 -0500
Daniel Roe <daniel.r.roe.gmail.com> wrote:

> On Tue, Feb 23, 2010 at 4:20 AM, Hannes Loeffler
> <Hannes.Loeffler.stfc.ac.uk
> > wrote:
>
> > Shouldn't it be also idiomatic to set a pointer to NULL after
> > free? I mention this because I see it in clearParm() but not in
> > safe_free() (utility.c).
> >
>
> It won't work in safe_free because of the scope of the pointer. In
> the case of clearParm() the function operates on the parm structure,
> which is more or less global, so setting it to NULL from clearParm()
> will actually have an affect on parm. However, in safe_free() the
> pointer is passed in, so setting it to NULL inside the function has
> no affect on the pointer outside the function.

Ok, thanks. (A small test program would have clarified this...)


Cheers,
Hannes.

_______________________________________________
AMBER-Developers mailing list
AMBER-Developers.ambermd.org
http://lists.ambermd.org/mailman/listinfo/amber-developers
Received on Tue Feb 23 2010 - 08:30:09 PST
Custom Search