server: fix some leaks