From: Samuel Thibault <samuel.thibault@gnu.org>
To: bug-hurd@gnu.org, thomas@codesourcery.com, gdb-patches@sourceware.org
Subject: [PATCH,Hurd] Fix deallocation after proc_getprocinfo call
Date: Sun, 02 Nov 2014 15:26:00 -0000 [thread overview]
Message-ID: <20141102152537.GG2991@type.youpi.perso.aquilenet.fr> (raw)
2014-10-02 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.
diff --git a/gdb/gnu-nat.c b/gdb/gnu-nat.c
index d17a750..c571190 100644
--- a/gdb/gnu-nat.c
+++ b/gdb/gnu-nat.c
@@ -804,7 +804,7 @@ 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 +844,9 @@ 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)
{
next reply other threads:[~2014-11-02 15:26 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-02 15:26 Samuel Thibault [this message]
2014-11-23 7:44 ` Joel Brobecker
2014-11-23 9:13 ` Samuel Thibault
2014-11-23 9:56 ` Joel Brobecker
2014-11-23 15:21 ` Samuel Thibault
2014-11-23 15:19 ` [PATCHv2,Hurd] " Samuel Thibault
2014-11-24 9:28 ` Joel Brobecker
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20141102152537.GG2991@type.youpi.perso.aquilenet.fr \
--to=samuel.thibault@gnu.org \
--cc=bug-hurd@gnu.org \
--cc=gdb-patches@sourceware.org \
--cc=thomas@codesourcery.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox