diff options
author | Tom Tromey <tom@tromey.com> | 2018-06-07 15:38:25 -0600 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2018-06-08 07:05:49 -0600 |
commit | 343b0027aed57c5a2d499e7e6e228608969a10be (patch) | |
tree | df77bb9b7a3f732fad917d8a7a7afeac237f1376 /gdb/btrace.c | |
parent | 8dcc53b37f4fe4797825c2a43bb1fb3df56b30d1 (diff) | |
download | gdb-343b0027aed57c5a2d499e7e6e228608969a10be.zip gdb-343b0027aed57c5a2d499e7e6e228608969a10be.tar.gz gdb-343b0027aed57c5a2d499e7e6e228608969a10be.tar.bz2 |
Remove last cleanup from btrace code
This removes the last cleanup from btrace.c, replacing it with a use
of unique_xmalloc_ptr.
gdb/ChangeLog
2018-06-08 Tom Tromey <tom@tromey.com>
* btrace.c (parse_xml_raw): Use gdb::unique_xmalloc_ptr.
Diffstat (limited to 'gdb/btrace.c')
-rw-r--r-- | gdb/btrace.c | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/gdb/btrace.c b/gdb/btrace.c index 6907705..b8894a2 100644 --- a/gdb/btrace.c +++ b/gdb/btrace.c @@ -2056,8 +2056,7 @@ static void parse_xml_raw (struct gdb_xml_parser *parser, const char *body_text, gdb_byte **pdata, size_t *psize) { - struct cleanup *cleanup; - gdb_byte *data, *bin; + gdb_byte *bin; size_t len, size; len = strlen (body_text); @@ -2066,8 +2065,8 @@ parse_xml_raw (struct gdb_xml_parser *parser, const char *body_text, size = len / 2; - bin = data = (gdb_byte *) xmalloc (size); - cleanup = make_cleanup (xfree, data); + gdb::unique_xmalloc_ptr<gdb_byte> data ((gdb_byte *) xmalloc (size)); + bin = data.get (); /* We use hex encoding - see common/rsp-low.h. */ while (len > 0) @@ -2084,9 +2083,7 @@ parse_xml_raw (struct gdb_xml_parser *parser, const char *body_text, len -= 2; } - discard_cleanups (cleanup); - - *pdata = data; + *pdata = data.release (); *psize = size; } |