diff options
Diffstat (limited to 'gdb/xstormy16-tdep.c')
-rw-r--r-- | gdb/xstormy16-tdep.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/gdb/xstormy16-tdep.c b/gdb/xstormy16-tdep.c index 47fc86b..d5e315c 100644 --- a/gdb/xstormy16-tdep.c +++ b/gdb/xstormy16-tdep.c @@ -279,16 +279,20 @@ xstormy16_push_dummy_call (struct gdbarch *gdbarch, for (j = nargs - 1; j >= i; j--) { char *val; + struct cleanup *back_to; + const gdb_byte *bytes = value_contents (args[j]); typelen = TYPE_LENGTH (value_enclosing_type (args[j])); slacklen = typelen & 1; - val = alloca (typelen + slacklen); - memcpy (val, value_contents (args[j]), typelen); + val = xmalloc (typelen + slacklen); + back_to = make_cleanup (xfree, val); + memcpy (val, bytes, typelen); memset (val + typelen, 0, slacklen); /* Now write this data to the stack. The stack grows upwards. */ write_memory (stack_dest, val, typelen + slacklen); stack_dest += typelen + slacklen; + do_cleanups (back_to); } store_unsigned_integer (buf, xstormy16_pc_size, byte_order, bp_addr); |