Fixed static memory leaks