libmemif: fix incorrect write leading to memory corruption

No match.