LD_PRELOAD causing Segmentation fault for linux commands

I have a .so file which is used for finding memory leaks. I set the LD_PRELOAD env variable in the session in which I want to execute my target binary. export LD_PRELOAD=./memleakfinder.so But once this environment variable is set, even a simple linux command like ls or ps is causing a Segmentation fault (core dumped). Why is that happening?I've overloaded versions of malloc(),calloc(),realloc(),free(),new,new[] etc. in that .so file. The automatic bug reporting tool of CentOS6 is saying: source:coreutils Problem:process /bin/ls was killed by signal 11(SIGSEGV). Clearly the library injection is causing the problem here. How can I avoid it?


Instead of exporting an environmental variable, prepend the variable to the command you want to run/debug.

For example:

LD_PRELOAD=./memleakfinder.so a.out

And the library will only be loaded for this one invocation of a.out instead of all commands in the current shell.

We cannot help you determine the cause of the segmentation fault without seeing some code.

Need Your Help

Ext JS: Proper technique to filter a combobox?

javascript extjs combobox store

When I filter a combobox by adding a filter to the underlying store, sometimes the filter works (items are removed) and sometimes it has no effect. I have debugged the filterBy function; it is being

"Unterminated string" when including quote in string literal on Turbo C compiler

c string character turbo-c

I have this on my program and it shows an error saying : Unterminated string.