Added -Wextra and fixed a memory leak