[gmx-developers] [PATCH} Fix for doble free memory coruption in gmx_genion.c

hess at sbc.su.se hess at sbc.su.se
Fri Feb 19 14:55:45 CET 2010


There is indeed a problem with fpin which is close twice, I fixed that now.
But fpout is opened twice and closed twice (and closed twiced conditionally
followed by a gmx_fatal call), so there should be no problem there,

Berk

> Also file descriptors fpin and fpout closed two times unconditionaly
> so second close cause double free memory corruption
> alexxy at quad ~/src/gromacs/src/tools $ grep  -E 'fopen|fclose' gmx_genion.c
>   fpin = ffopen(topinout,"r");
>   fpout= ffopen(TEMP_FILENM,"w");
>   ffclose(fpin);
>     ffclose(fpout);
>     ffclose(fpout);
>   ffclose(fpin);
>   ffclose(fpout);
>   /* use ffopen to generate backup of topinout */
>   fpout=ffopen(topinout,"w");
>   ffclose(fpout);
>
>
> 2010/2/19  <hess at sbc.su.se>:
>> Hi,
>>
>> The gmx_genion.c code is correct (there might be memory leaks,
>> but every Gromacs program has that problem).
>> Your fix is surely incorrect, you leaving two open files open.
>>
>> Berk
>>
>>> Hi
>>>
>>> Here patch to fix double free memory coruption in gmx_genion.c
>>>
>>> --
>>> Best Regards,
>>> Alexey 'Alexxy' Shvetsov
>>> Petersburg Nuclear Physics Institute, Russia
>>> Department of Molecular and Radiation Biophysics
>>> Gentoo Team Ru
>>> Gentoo Linux Dev
>>> mailto:alexxyum at gmail.com
>>> mailto:alexxy at gentoo.org
>>> mailto:alexxy at omrb.pnpi.spb.ru
>>> --
>>> gmx-developers mailing list
>>> gmx-developers at gromacs.org
>>> http://lists.gromacs.org/mailman/listinfo/gmx-developers
>>> Please don't post (un)subscribe requests to the list. Use the
>>> www interface or send it to gmx-developers-request at gromacs.org.
>>
>> --
>> gmx-developers mailing list
>> gmx-developers at gromacs.org
>> http://lists.gromacs.org/mailman/listinfo/gmx-developers
>> Please don't post (un)subscribe requests to the list. Use the
>> www interface or send it to gmx-developers-request at gromacs.org.
>>
>
>
>
> --
> Best Regards,
> Alexey 'Alexxy' Shvetsov
> Petersburg Nuclear Physics Institute, Russia
> Department of Molecular and Radiation Biophysics
> Gentoo Team Ru
> Gentoo Linux Dev
> mailto:alexxyum at gmail.com
> mailto:alexxy at gentoo.org
> mailto:alexxy at omrb.pnpi.spb.ru
> --
> gmx-developers mailing list
> gmx-developers at gromacs.org
> http://lists.gromacs.org/mailman/listinfo/gmx-developers
> Please don't post (un)subscribe requests to the list. Use the
> www interface or send it to gmx-developers-request at gromacs.org.
>




More information about the gromacs.org_gmx-developers mailing list