Fix memory leak.
Make everything compilable with gcc.