Fix issue 740, memory leak

Fix issue #740