This fixes potential memory leak at GTM, reported and fixed by Nikhil Sontakke.
Reviewed by Koichi Suzuki.