server: fix ws memory leak (fixes #268)