Memory leak fix.

Allocate tree storage only withing context of the root grammar.