Re: [AMBER-Developers] malloc error when freeing pointer in CVS ptraj

From: Daniel Roe <>
Date: Tue, 16 Mar 2010 16:19:53 -0400

Hi Ben,

This has to do with the safe_free function not really being safe. In the
case of doing 'solvent byname' an atom mask in the code is not allocated,
resulting in the invalid free. The attached patch should fix it. Let me know
if it doesn't work.


On Tue, Mar 16, 2010 at 3:49 PM, Ben Roberts <> wrote:

> Hi all,
> I discovered a rather annoying tendency in ptraj to throw a spaz while I
> attempted to specify solvent residues by name.
> As usual, intel compilers (11.1.084) on a Mac (SL 10.6.2).
> I admit my CVS version is a few days old, and is not Dave's release
> candidate of AT. However, is this a known problem that has been
> fixed since a week or so ago?
> Stdout follows:
> <snip>
> PTRAJ: Processing input from "STDIN" ...
> trajin BPR-20100315-001_in.rst7
> PTRAJ: trajin BPR-20100315-001_in.rst7
> Checking coordinates: BPR-20100315-001_in.rst7
> solvent byname WAT Na+ Cl-
> PTRAJ: solvent byname WAT Na+ Cl-
> Searching for solvent by residue name WAT
> ptraj(3216) malloc: *** error for object 0x100a01360: pointer being freed
> was not allocated
> *** set a breakpoint in malloc_error_break to debug
> Abort trap
> Any thoughts from the ptraj crew? I've worked around, in the
> present case through selecting residues by ID, but I hope a
> better solution can be produced. I'm happy to help, though I'm
> not a C expert.
> Cheers,
> Ben
> _______________________________________________
> AMBER-Developers mailing list

AMBER-Developers mailing list

Received on Tue Mar 16 2010 - 13:30:04 PDT
Custom Search