opencog/link-grammar — pull request #47 by linas (2014-12-19 19:40:28+00:00)
Title: Fix crazy libbfd symbol collision

Apparently, /usr/lib/libbfd-2.24-system.so has a symbol called "xrealloc" in it, and opencog links to libbfd to perform pretty stack-trace printing. Due to dynamic linking order, the xrealloc in link-grammar gets resolved by the symbol in libbfd, instead of the one in liblink-grammar. The libbfd version is expecting the new size as the second argument. But we pass the old size in that location. So the returned arrays are always too small, and memory corruption results.

The solution is to stop using xrealloc which no longer serves a purpose anyway.