This looks like a bug but I wanted to post it here before adding it to the
bug database.  It's using some memory after freeing it.

This is output from valgrind.  The first stack trace reports the invalid
free, and the second stack trace shows the code that freed the memory
earlier.

Craig

==23964== Invalid read of size 8
==23964==    at 0x4FD4375: OpenBabel::OBCisTransStereo::IsValid() const
(cistrans.cpp:89)
==23964==    by 0x4FD616E:
OpenBabel::OBCisTransStereo::GetConfig(OpenBabel::OBStereo::Shape) const
(cistrans.cpp:125)
==23964==    by 0x4EB4560:
OpenBabel::CanonicalLabelsImpl::CalcCanonicalLabels(OpenBabel::OBMol*,
std::vector<unsigned int, std::allocator<unsigned int> > const&, std\
::vector<unsigned int, std::allocator<unsigned int> >&,
std::vector<OpenBabel::OBStereoUnit,
std::allocator<OpenBabel::OBStereoUnit> > const&, OpenBabel::OBBitVec con\
st&, OpenBabel::OBStereoFacade*, int, bool) (canon.cpp:1534)
==23964==    by 0x4EA96EB: OpenBabel::CanonicalLabels(OpenBabel::OBMol*,
std::vector<unsigned int, std::allocator<unsigned int> > const&,
std::vector<unsigned int, st\
d::allocator<unsigned int> >&, OpenBabel::OBBitVec const&, int, bool)
(canon.cpp:1735)
==23964==    by 0x9F0F41E:
OpenBabel::OBMol2Cansmi::CreateFragCansmiString(OpenBabel::OBMol&,
OpenBabel::OBBitVec&, bool, char*) (smilesformat.cpp:3802)
==23964==    by 0x9F1053E: OpenBabel::CreateCansmiString(OpenBabel::OBMol&,
char*, OpenBabel::OBBitVec&, bool, OpenBabel::OBConversion*)
(smilesformat.cpp:4025)
==23964==    by 0x9F11C2A:
OpenBabel::SMIBaseFormat::WriteMolecule(OpenBabel::OBBase*,
OpenBabel::OBConversion*) (smilesformat.cpp:4091)
==23964==    by 0x4F5F7C9:
OpenBabel::OBConversion::Write(OpenBabel::OBBase*, std::ostream*)
(obconversion.cpp:833)
==23964==    by 0x4F61944:
OpenBabel::OBConversion::WriteString(OpenBabel::OBBase*, bool)
(obconversion.cpp:856)
==23964==    by 0x40D1CE: AddRingGroups (in
/home/cjames/emi/src/trunk/postgres_chmoogle/chemistry/test/smi2keywords)
==23964==    by 0x40DB7E: chmoogle_ring_keywords (in
/home/cjames/emi/src/trunk/postgres_chmoogle/chemistry/test/smi2keywords)
==23964==    by 0x407543: chmoogle_ichem_keywords (in
/home/cjames/emi/src/trunk/postgres_chmoogle/chemistry/test/smi2keywords)
==23964==  Address 0x158bf178 is 40 bytes inside a block of size 88 free'd
==23964==    at 0x4C26DCF: operator delete(void*) (vg_replace_malloc.c:387)
==23964==    by 0x4E924D5: OpenBabel::OBBase::DeleteData(unsigned int)
(base.cpp:199)
==23964==    by 0x4EA97A9: OpenBabel::CanonicalLabels(OpenBabel::OBMol*,
std::vector<unsigned int, std::allocator<unsigned int> > const&,
std::vector<unsigned int, st\
d::allocator<unsigned int> >&, OpenBabel::OBBitVec const&, int, bool)
(canon.cpp:1718)
==23964==    by 0x9F0F41E:
OpenBabel::OBMol2Cansmi::CreateFragCansmiString(OpenBabel::OBMol&,
OpenBabel::OBBitVec&, bool, char*) (smilesformat.cpp:3802)
==23964==    by 0x9F1053E: OpenBabel::CreateCansmiString(OpenBabel::OBMol&,
char*, OpenBabel::OBBitVec&, bool, OpenBabel::OBConversion*)
(smilesformat.cpp:4025)
==23964==    by 0x9F11C2A:
OpenBabel::SMIBaseFormat::WriteMolecule(OpenBabel::OBBase*,
OpenBabel::OBConversion*) (smilesformat.cpp:4091)
==23964==    by 0x4F5F7C9:
OpenBabel::OBConversion::Write(OpenBabel::OBBase*, std::ostream*)
(obconversion.cpp:833)
==23964==    by 0x4F61944:
OpenBabel::OBConversion::WriteString(OpenBabel::OBBase*, bool)
(obconversion.cpp:856)
==23964==    by 0x40D1CE: AddRingGroups (in
/home/cjames/emi/src/trunk/postgres_chmoogle/chemistry/test/smi2keywords)
==23964==    by 0x40DB7E: chmoogle_ring_keywords (in
/home/cjames/emi/src/trunk/postgres_chmoogle/chemistry/test/smi2keywords)
==23964==    by 0x407543: chmoogle_ichem_keywords (in
/home/cjames/emi/src/trunk/postgres_chmoogle/chemistry/test/smi2keywords)
==23964==    by 0x405604: main (smi2keywords.c:44)
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
OpenBabel-Devel mailing list
OpenBabel-Devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbabel-devel

Reply via email to