Avoid updating memory protection on allocations that have the right protection.
This commit is contained in:
committed by
Anton Kirilov
parent
54896ac86d
commit
61ecccf306
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user