+2009-02-27 Phil Muldoon <pmuldoon@redhat.com>
+
+ * valprint.c (read_string): Rework clean-up logic. Use
+ free_current_contents to clean-up buffer.
+
2009-02-27 Andreas Schwab <schwab@linux-m68k.org>
* MAINTAINERS: Update e-mail address.
some error, such as bumping into the end of the address space. */
found_nul = 0;
- old_chain = make_cleanup (null_cleanup, 0);
+ *buffer = NULL;
+
+ old_chain = make_cleanup (free_current_contents, buffer);
if (len > 0)
{
*buffer = (gdb_byte *) xmalloc (len * width);
bufptr = *buffer;
- old_chain = make_cleanup (xfree, *buffer);
nfetch = partial_memory_read (addr, bufptr, len * width, &errcode)
/ width;
{
unsigned long bufsize = 0;
- *buffer = NULL;
-
do
{
QUIT;
if (*buffer == NULL)
*buffer = (gdb_byte *) xmalloc (nfetch * width);
else
- {
- discard_cleanups (old_chain);
- *buffer = (gdb_byte *) xrealloc (*buffer,
- (nfetch + bufsize) * width);
- }
+ *buffer = (gdb_byte *) xrealloc (*buffer,
+ (nfetch + bufsize) * width);
- old_chain = make_cleanup (xfree, *buffer);
bufptr = *buffer + bufsize * width;
bufsize += nfetch;