rmitm: fix null pointer deref in flush thread