minor memory leak fix from patch 82d5e763a446eb60e077252ecd990b94e1d94248