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

From: Hannes Loeffler <Hannes.Loeffler.stfc.ac.uk>
Date: Tue, 23 Feb 2010 09:20:58 +0000

On Mon, 22 Feb 2010 12:26:47 -0500
Scott Brozell <sbrozell.rci.rutgers.edu> wrote:

> Hi,
>
> On Mon, Feb 22, 2010 at 12:20:05PM -0500, Daniel Roe wrote:
> > This is fortunately not to big an issue, but it's always good to be
> > thorough when it comes to keeping track of pointers.
> >
> > The line should read :
> >
> > if (parm!=NULL) clearParm(parm);
> >
> > since I believe the parm structure is not initialized if non-amber
> > top is used. I will check this in to the CVS tree after testing.
>
> That fix would be consistent with the other ptraj calls of clearParm.
> However, I
> changed the function clearParm so that it handles a NULL pointer
> argument. Since that is idiomatic C (and thus less error prone),
> it is preferred to pre-checking the argument.

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).


> Thanks for the report,
> Scott
>
> > -Dan
> >
> > On Mon, Feb 22, 2010 at 11:57 AM, Hannes Loeffler <
> > Hannes.Loeffler.stfc.ac.uk> wrote:
> >
> > > Hi,
> > >
> > > I think there is a bug in ptrajCleanup (ptraj.c) showing up in
> > > the last line:
> > >
> > > clearParm(parm);
> > >
> > > Gdb tells me that parm is a null pointer when the function is
> > > called. I should point out that I do not see this problem with
> > > AMBER top/crd files but only with PSF/DCD input (NAMD generated).
>
> _______________________________________________
> AMBER-Developers mailing list
> AMBER-Developers.ambermd.org
> http://lists.ambermd.org/mailman/listinfo/amber-developers

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