s4:pyrpc: fix memory leaks in error pathes