diff options
author | Samuel Thibault <samuel.thibault@gnu.org> | 2014-11-23 16:19:46 +0100 |
---|---|---|
committer | Joel Brobecker <brobecker@adacore.com> | 2014-11-24 13:28:03 +0400 |
commit | a441dfbc4e339198cf9d27d21579fd04ff8c6e2c (patch) | |
tree | fde5fd8aacc47898b17c2f0c35895ba3b5799142 /gdb/gnu-nat.c | |
parent | 4c9e848275b2073db55ebc1b7c18a52ab32954eb (diff) | |
download | gdb-a441dfbc4e339198cf9d27d21579fd04ff8c6e2c.zip gdb-a441dfbc4e339198cf9d27d21579fd04ff8c6e2c.tar.gz gdb-a441dfbc4e339198cf9d27d21579fd04ff8c6e2c.tar.bz2 |
[Hurd] Fix deallocation after proc_getprocinfo call
2014-11-24 Samuel Thibault <samuel.thibault@ens-lyon.org>
* gdb/gnu-nat.c (inf_validate_procinfo): Multiply the number of
elements pi_len by the size of the elements before calling
vm_deallocate.
(inf_validate_task_sc): Likewise, and properly deallocate the
noise array.
Diffstat (limited to 'gdb/gnu-nat.c')
-rw-r--r-- | gdb/gnu-nat.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/gdb/gnu-nat.c b/gdb/gnu-nat.c index d17a750..6dbf31d 100644 --- a/gdb/gnu-nat.c +++ b/gdb/gnu-nat.c @@ -804,7 +804,8 @@ inf_validate_procinfo (struct inf *inf) inf->nomsg = !!(pi->state & PI_NOMSG); if (inf->nomsg) inf->traced = !!(pi->state & PI_TRACED); - vm_deallocate (mach_task_self (), (vm_address_t) pi, pi_len); + vm_deallocate (mach_task_self (), (vm_address_t) pi, + pi_len * sizeof (*(procinfo_t) 0)); if (noise_len > 0) vm_deallocate (mach_task_self (), (vm_address_t) noise, noise_len); } @@ -844,9 +845,10 @@ inf_validate_task_sc (struct inf *inf) suspend_count = pi->taskinfo.suspend_count; - vm_deallocate (mach_task_self (), (vm_address_t) pi, pi_len); + vm_deallocate (mach_task_self (), (vm_address_t) pi, + pi_len * sizeof (*(procinfo_t) 0)); if (noise_len > 0) - vm_deallocate (mach_task_self (), (vm_address_t) pi, pi_len); + vm_deallocate (mach_task_self (), (vm_address_t) noise, noise_len); if (inf->task->cur_sc < suspend_count) { |