Fix potential memleak.