fix memory leak in zero-copy allocation

two allocations were being made where only one made sense.

closes #486