Avoid updating memory protection on allocations that have the right protection.
@@ -179,6 +179,8 @@ impl Memory {
}
}
}
+
+ self.executable = self.allocations.len();
}
/// Set all memory allocated in this `Memory` up to now as readonly.
@@ -208,12 +210,15 @@ impl Memory {
}
}
}
+
+ self.executable = self.allocations.len();
}
/// Frees all allocated memory regions that would be leaked otherwise.
/// Likely to invalidate existing function pointers, causing unsafety.
pub(crate) unsafe fn free_memory(&mut self) {
self.allocations.clear();
+ self.executable = 0;
}
}
