Fix memleak of map events.

Fixes #122.