diff options
author | Tom Tromey <tom@tromey.com> | 2019-02-14 16:10:01 -0700 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2019-03-06 16:04:31 -0700 |
commit | c6321f19c5414c2a34db3cf5979834d081c32abd (patch) | |
tree | 45d22a57933115456a6b1c4ecbc9bc3328a39be2 | |
parent | 61b30099702a76fb7e6a9c5dba7c03b95f9eb0f2 (diff) | |
download | gdb-c6321f19c5414c2a34db3cf5979834d081c32abd.zip gdb-c6321f19c5414c2a34db3cf5979834d081c32abd.tar.gz gdb-c6321f19c5414c2a34db3cf5979834d081c32abd.tar.bz2 |
Use unique_xmalloc_ptr in remote.c
This removes a cleanup from remote.c, replacing it with
unique_xmalloc_ptr.
2019-03-06 Tom Tromey <tom@tromey.com>
* remote.c (remote_target::remote_parse_stop_reply): Use
unique_xmalloc_ptr.
-rw-r--r-- | gdb/ChangeLog | 5 | ||||
-rw-r--r-- | gdb/remote.c | 9 |
2 files changed, 9 insertions, 5 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index ef323e1..38ce62f 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,10 @@ 2019-03-06 Tom Tromey <tom@tromey.com> + * remote.c (remote_target::remote_parse_stop_reply): Use + unique_xmalloc_ptr. + +2019-03-06 Tom Tromey <tom@tromey.com> + * stabsread.c (struct stabs_field_info): Rename from field_info. <list, fnlist>: Add initializers. <obstack>: New member. diff --git a/gdb/remote.c b/gdb/remote.c index 7d556ad..ef12fe9 100644 --- a/gdb/remote.c +++ b/gdb/remote.c @@ -7312,14 +7312,13 @@ Packet: '%s'\n"), /* Save the pathname for event reporting and for the next run command. */ - char *pathname = (char *) xmalloc (pathlen + 1); - struct cleanup *old_chain = make_cleanup (xfree, pathname); - hex2bin (p1, (gdb_byte *) pathname, pathlen); + gdb::unique_xmalloc_ptr<char[]> pathname + ((char *) xmalloc (pathlen + 1)); + hex2bin (p1, (gdb_byte *) pathname.get (), pathlen); pathname[pathlen] = '\0'; - discard_cleanups (old_chain); /* This is freed during event handling. */ - event->ws.value.execd_pathname = pathname; + event->ws.value.execd_pathname = pathname.release (); event->ws.kind = TARGET_WAITKIND_EXECD; /* Skip the registers included in this packet, since |