fix memory leak introduced with commit 2a0aec58a4c2cfeb350a9bf951a0ea2dab69659d