fixed a memory bug calling WS C functions

--HG--
branch : next