fix memory leak

fix memory leak issue introduced in 331c025cf83a81027032f880ca02fd828d975eeb