memif: don't leak error strings in API handlers