summaryrefslogtreecommitdiff
path: root/gdb/valops.c
diff options
context:
space:
mode:
authorsiddhesh <siddhesh>2012-07-23 18:08:27 +0000
committersiddhesh <siddhesh>2012-07-23 18:08:27 +0000
commita962b808682570763a45279b35abe4fd058b21d2 (patch)
tree57fef61e565bc3425596993e6e1a07a861f38104 /gdb/valops.c
parentd0c57e98a587a85fccf8377096a3ff0956099be0 (diff)
downloadgdb-a962b808682570763a45279b35abe4fd058b21d2.tar.gz
* p-valprint.c (pascal_object_print_value): Replace potentially
unsafe alloca with xmalloc/xfree. * valops.c (search_struct_method): Likewise.
Diffstat (limited to 'gdb/valops.c')
-rw-r--r--gdb/valops.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/gdb/valops.c b/gdb/valops.c
index 97d889b2bcf..f6d8441581d 100644
--- a/gdb/valops.c
+++ b/gdb/valops.c
@@ -2281,8 +2281,13 @@ search_struct_method (const char *name, struct value **arg1p,
if (offset < 0 || offset >= TYPE_LENGTH (type))
{
- gdb_byte *tmp = alloca (TYPE_LENGTH (baseclass));
- CORE_ADDR address = value_address (*arg1p);
+ gdb_byte *tmp;
+ struct cleanup *back_to;
+ CORE_ADDR address;
+
+ tmp = xmalloc (TYPE_LENGTH (baseclass));
+ back_to = make_cleanup (xfree, tmp);
+ address = value_address (*arg1p);
if (target_read_memory (address + offset,
tmp, TYPE_LENGTH (baseclass)) != 0)
@@ -2293,6 +2298,7 @@ search_struct_method (const char *name, struct value **arg1p,
address + offset);
base_valaddr = value_contents_for_printing (base_val);
this_offset = 0;
+ do_cleanups (back_to);
}
else
{