diff options
author | Siddhesh Poyarekar <siddhesh@sourceware.org> | 2012-07-23 18:08:29 +0000 |
---|---|---|
committer | Siddhesh Poyarekar <siddhesh@sourceware.org> | 2012-07-23 18:08:29 +0000 |
commit | 6c18f3e0f4d7e0399b39a0d554b5152af71a94e2 (patch) | |
tree | 492cc1fb9f64c05b8723fcb0ede1a7d981f88bc6 /gdb/p-valprint.c | |
parent | 695c31738b1a1f052f777630bd914b7f3f783b9b (diff) | |
download | gdb-6c18f3e0f4d7e0399b39a0d554b5152af71a94e2.zip gdb-6c18f3e0f4d7e0399b39a0d554b5152af71a94e2.tar.gz gdb-6c18f3e0f4d7e0399b39a0d554b5152af71a94e2.tar.bz2 |
* p-valprint.c (pascal_object_print_value): Replace potentially
unsafe alloca with xmalloc/xfree.
* valops.c (search_struct_method): Likewise.
Diffstat (limited to 'gdb/p-valprint.c')
-rw-r--r-- | gdb/p-valprint.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/gdb/p-valprint.c b/gdb/p-valprint.c index b8434ed..9f44617 100644 --- a/gdb/p-valprint.c +++ b/gdb/p-valprint.c @@ -797,8 +797,11 @@ pascal_object_print_value (struct type *type, const gdb_byte *valaddr, if (boffset < 0 || boffset >= TYPE_LENGTH (type)) { - /* FIXME (alloc): not safe is baseclass is really really big. */ - gdb_byte *buf = alloca (TYPE_LENGTH (baseclass)); + gdb_byte *buf; + struct cleanup *back_to; + + buf = xmalloc (TYPE_LENGTH (baseclass)); + back_to = make_cleanup (xfree, buf); base_valaddr = buf; if (target_read_memory (address + boffset, buf, @@ -807,6 +810,7 @@ pascal_object_print_value (struct type *type, const gdb_byte *valaddr, address = address + boffset; thisoffset = 0; boffset = 0; + do_cleanups (back_to); } else base_valaddr = valaddr; |