Fix possible memory leak caused in 35cd4fbc223c8dca9cde7e53eda1c15571bc8104