mdb: only swap the buffers back if the memo length is zero

See c68c915d2430c80080907f46a90d5ea203cfd117.  Swapping on a memo with
length greater than 0 has the potential to introduce an infinite loop.