[gmx-developers] do_dssp git segfault bugfix

Carsten Kutzner ckutzne at gwdg.de
Thu Jun 18 14:31:36 CEST 2009


Hi,

the recent (git-master) version of do_dssp segfaults
the first time a memory allocation is made after the
routine check_oo is called.

This is check_oo:

static void check_oo(t_atoms *atoms)
{
  char *OOO;

  int i;

  OOO=strdup("O");

  for(i=0; (i<atoms->nr); i++) {
    if (strcmp(*(atoms->atomname[i]),"OXT")==0)
      atoms->atomname[i]=&OOO;
    else if (strcmp(*(atoms->atomname[i]),"O1")==0)
      atoms->atomname[i]=&OOO;
  }
}

The error might have been introduced by recently omitting the static
attribute to char *OOO, thus leaving &OOO undefined when
check_oo is left. A fix is to use

       *atoms->atomname[i]=OOO;

in the atomname= statements. What is unclear to me is
a) Why is only "OXT" and "O1" replaced by "O" and not e.g. "O2" also.
b) Why is atomname not simply char ** (thus leaving one unnecessary
    pointer layer away) instead of char *** ?

Thanks for clarifications,
  Carsten


--
Dr. Carsten Kutzner
Max Planck Institute for Biophysical Chemistry
Theoretical and Computational Biophysics
Am Fassberg 11, 37077 Goettingen, Germany
Tel. +49-551-2012313, Fax: +49-551-2012302
http://www.mpibpc.mpg.de/home/grubmueller/ihp/ckutzne








More information about the gromacs.org_gmx-developers mailing list