procctl(PROC_ASLR_STATUS): fix vmspace leak

Reported by:	jhb
Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
This commit is contained in:
Konstantin Belousov 2021-07-15 02:40:04 +03:00
parent 9873c807da
commit 0bdb2cbf9d

View File

@ -530,8 +530,9 @@ aslr_status(struct thread *td, struct proc *p, int *data)
_PHOLD(p);
PROC_UNLOCK(p);
vm = vmspace_acquire_ref(p);
if (vm != NULL && (vm->vm_map.flags & MAP_ASLR) != 0) {
d |= PROC_ASLR_ACTIVE;
if (vm != NULL) {
if ((vm->vm_map.flags & MAP_ASLR) != 0)
d |= PROC_ASLR_ACTIVE;
vmspace_free(vm);
}
PROC_LOCK(p);