I've been playing around with a very cool feature of gcc, which is the set of "sanitizer" tools it has built-in now. If you're familiar with valgrind, it can catch many of the same kinds of errors but the program runs a *lot* faster than it does under valgrind and seems to do a better job of pinpointing where the relevant objects are referenced in the source.
Anyway, with -fsanitize=address and valgrind, I found a few little things that could potentially cause problems. These include some uninitialized variables being accessed, some memory being accessed after it was freed, and a *lot* of little memory leaks.
A bunch of the memory leaks are in the animation system and I haven't figured out where to free things yet, but I've fixed a bunch of the other problems. I'll have a pull request coming for those misc clean-ups soon.