fixed a memleak in the patch for bug 587757