When using gcc under Linux, a good tool for identifying memory problems is Valgrind. It can find heap allocated leaks and buffer overflows....
Separate names with a comma.