BUG: fix memory leak in ndimage.label.  Closes gh-3148.