Index: sys/kern/kern_exec.c =================================================================== --- sys/kern/kern_exec.c +++ sys/kern/kern_exec.c @@ -981,8 +981,8 @@ if (ma[0]->valid != VM_PAGE_BITS_ALL) { vm_page_xbusy(ma[0]); if (!vm_pager_has_page(object, 0, NULL, &after)) { - vm_page_unwire_noq(ma[0]); - vm_page_free(ma[0]); + if (vm_page_unwire_noq(ma[0])) + vm_page_deactivate_noreuse(ma[0]); VM_OBJECT_WUNLOCK(object); return (EIO); } @@ -1006,9 +1006,10 @@ initial_pagein = i; rv = vm_pager_get_pages(object, ma, initial_pagein, NULL, NULL); if (rv != VM_PAGER_OK) { - vm_page_unwire_noq(ma[0]); - for (i = 0; i < initial_pagein; i++) - vm_page_free(ma[i]); + for (i = 0; i < initial_pagein; i++) { + if (i > 0 || vm_page_unwire_noq(ma[i])) + vm_page_deactivate_noreuse(ma[i]); + } VM_OBJECT_WUNLOCK(object); return (EIO); }