KERN_PROC_VM_LAYOUT sysctl: fix bug in 32-bit-compatible path

vmspace_free() is called redundantly in the 32-bit-compatible
path in sysctl_kern_proc_vm_layout(), causing a premature free
(possibly for the current address space).  Remove the extra call.

PR:		272401
Reported by:	marklmi at yahoo.com
Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D40908
This commit is contained in:
Mike Karels 2023-07-07 08:37:16 -05:00
parent c81495a621
commit be30fd3ab2

View file

@ -3286,7 +3286,6 @@ sysctl_kern_proc_vm_layout(SYSCTL_HANDLER_ARGS)
kvm32.kvm_shp_addr = (uint32_t)kvm.kvm_shp_addr;
kvm32.kvm_shp_size = (uint32_t)kvm.kvm_shp_size;
kvm32.kvm_map_flags = kvm.kvm_map_flags;
vmspace_free(vmspace);
error = SYSCTL_OUT(req, &kvm32, sizeof(kvm32));
goto out;
}