server: fix *** glibc detected ***  double free or corruption on exit