Fix global leak for subprocess