[BugFix] Correctly release memory of std::vector

Previously this code was plain wrong. It actually made a copy
of the vector and tried to swap its entries with the original vector.
The argument to swap even was a const reference!
Now we use the correct trick: vector().swap(other).