diff options
author | Petr Machata <pmachata@redhat.com> | 2012-10-30 16:53:37 +0100 |
---|---|---|
committer | Petr Machata <pmachata@redhat.com> | 2012-10-30 16:53:37 +0100 |
commit | 0ffa9f3f82febbcd475318ac282c456adb76c73c (patch) | |
tree | ceca0d3e6360a51c3c127c83d9196ed736ee8bb7 /sysdeps | |
parent | 429b1845ef6bee24d8ab5851e90018666c83c481 (diff) | |
download | ltrace-0ffa9f3f82febbcd475318ac282c456adb76c73c.tar.gz |
Call value_in_inferior instead of setting WHERE manually
On x86_64, this plugs a leak.
Diffstat (limited to 'sysdeps')
-rw-r--r-- | sysdeps/linux-gnu/m68k/fetch.c | 3 | ||||
-rw-r--r-- | sysdeps/linux-gnu/ppc/fetch.c | 7 | ||||
-rw-r--r-- | sysdeps/linux-gnu/s390/fetch.c | 4 | ||||
-rw-r--r-- | sysdeps/linux-gnu/x86/fetch.c | 7 |
4 files changed, 7 insertions, 14 deletions
diff --git a/sysdeps/linux-gnu/m68k/fetch.c b/sysdeps/linux-gnu/m68k/fetch.c index 5da09e9..f6d8a0b 100644 --- a/sysdeps/linux-gnu/m68k/fetch.c +++ b/sysdeps/linux-gnu/m68k/fetch.c @@ -134,8 +134,7 @@ arch_fetch_arg_next(struct fetch_context *context, enum tof type, if (sz < 4) context->stack_pointer += 4 - sz; - valuep->where = VAL_LOC_INFERIOR; - valuep->u.address = context->stack_pointer; + value_in_inferior(valuep, context->stack_pointer); context->stack_pointer += sz; } diff --git a/sysdeps/linux-gnu/ppc/fetch.c b/sysdeps/linux-gnu/ppc/fetch.c index 6e3bc1c..d534321 100644 --- a/sysdeps/linux-gnu/ppc/fetch.c +++ b/sysdeps/linux-gnu/ppc/fetch.c @@ -164,11 +164,8 @@ allocate_stack_slot(struct fetch_context *ctx, struct Process *proc, uintptr_t tmp = align((uint64_t)(uintptr_t)ctx->stack_pointer, a); ctx->stack_pointer = (arch_addr_t)tmp; - if (valuep != NULL) { - valuep->where = VAL_LOC_INFERIOR; - valuep->u.address = ctx->stack_pointer + off; - } - + if (valuep != NULL) + value_in_inferior(valuep, ctx->stack_pointer + off); ctx->stack_pointer += sz; return 0; diff --git a/sysdeps/linux-gnu/s390/fetch.c b/sysdeps/linux-gnu/s390/fetch.c index 498c923..fa8f42d 100644 --- a/sysdeps/linux-gnu/s390/fetch.c +++ b/sysdeps/linux-gnu/s390/fetch.c @@ -135,9 +135,7 @@ allocate_stack_slot(struct fetch_context *ctx, struct Process *proc, } size_t off = sz < a ? a - sz : 0; - - valuep->where = VAL_LOC_INFERIOR; - valuep->u.address = ctx->stack_pointer + off; + value_in_inferior(valuep, ctx->stack_pointer + off); ctx->stack_pointer += sz > a ? sz : a; return 0; diff --git a/sysdeps/linux-gnu/x86/fetch.c b/sysdeps/linux-gnu/x86/fetch.c index 62a1696..4dab4cc 100644 --- a/sysdeps/linux-gnu/x86/fetch.c +++ b/sysdeps/linux-gnu/x86/fetch.c @@ -27,6 +27,7 @@ #include <stdint.h> #include <stdlib.h> #include <string.h> +#include <stdio.h> #include "backend.h" #include "expr.h" @@ -142,10 +143,8 @@ allocate_stack_slot(struct fetch_context *context, context->stack_pointer = (void *)align((unsigned long)context->stack_pointer, a); - if (valuep != NULL) { - valuep->where = VAL_LOC_INFERIOR; - valuep->u.address = context->stack_pointer; - } + if (valuep != NULL) + value_in_inferior(valuep, context->stack_pointer); context->stack_pointer += sz; } |