Fixes memory leaks in client and server (unsecure http mode)