Fix significant memory leak.

Particularly, unserializing a function is frequent and leaked.