Fixed memory leak in Tree #11053

Change-Id: I4c58367d4041b5e61989fca5be6b037f7f8e0c01