From fdeb2a1249c984e59e73092df3ca73b4540fb844 Mon Sep 17 00:00:00 2001 From: Doug Evans Date: Thu, 7 May 2009 23:29:25 +0000 Subject: [PATCH] * linux-low.c (regsets_fetch_inferior_registers): Fix memory leak. (regsets_store_inferior_registers): Ditto. --- gdb/gdbserver/ChangeLog | 5 +++++ gdb/gdbserver/linux-low.c | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog index 680c168b7e..022f2666e7 100644 --- a/gdb/gdbserver/ChangeLog +++ b/gdb/gdbserver/ChangeLog @@ -1,3 +1,8 @@ +2009-05-07 Doug Evans + + * linux-low.c (regsets_fetch_inferior_registers): Fix memory leak. + (regsets_store_inferior_registers): Ditto. + 2009-05-06 Pedro Alves PR server/10048 diff --git a/gdb/gdbserver/linux-low.c b/gdb/gdbserver/linux-low.c index bf17904d70..46969b776f 100644 --- a/gdb/gdbserver/linux-low.c +++ b/gdb/gdbserver/linux-low.c @@ -2092,6 +2092,7 @@ regsets_fetch_inferior_registers () /* If we get EIO on a regset, do not try it again for this process. */ disabled_regsets[regset - target_regsets] = 1; + free (buf); continue; } else @@ -2106,6 +2107,7 @@ regsets_fetch_inferior_registers () saw_general_regs = 1; regset->store_function (buf); regset ++; + free (buf); } if (saw_general_regs) return 0; @@ -2165,6 +2167,7 @@ regsets_store_inferior_registers () /* If we get EIO on a regset, do not try it again for this process. */ disabled_regsets[regset - target_regsets] = 1; + free (buf); continue; } else if (errno == ESRCH) @@ -2173,6 +2176,7 @@ regsets_store_inferior_registers () already gone, in which case we simply ignore attempts to change its registers. See also the related comment in linux_resume_one_lwp. */ + free (buf); return 0; } else -- 2.34.1