Fix memc usage

Code in Ib6e9cce4 has a possiblity to hang. Fix that.

Change-Id: Ic430094ea4a08d305e9ac0b27588a9294ff5fe30