[2/8] Replace use of xfree with byte_vector

Message ID 20230709-trace-cleanups-v1-2-c410e1072fab@tromey.com
State New
Headers
Series Minor C++-ification and cleanup in trace targets |

Commit Message

Tom Tromey July 9, 2023, 5:01 p.m. UTC
  This replaces a use of xfree with a byte_vector.
---
 gdb/tracectf.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
  

Patch

diff --git a/gdb/tracectf.c b/gdb/tracectf.c
index 16461711da1..8f6ea250f61 100644
--- a/gdb/tracectf.c
+++ b/gdb/tracectf.c
@@ -1358,10 +1358,9 @@  ctf_target::xfer_partial (enum target_object object,
 	    {
 	      const struct bt_definition *array
 		= bt_ctf_get_field (event, scope, "contents");
-	      gdb_byte *contents;
 	      int k;
 
-	      contents = (gdb_byte *) xmalloc (mlen);
+	      gdb::byte_vector contents (mlen);
 
 	      for (k = 0; k < mlen; k++)
 		{
@@ -1377,8 +1376,6 @@  ctf_target::xfer_partial (enum target_object object,
 
 	      memcpy (readbuf, &contents[offset - maddr], amt);
 
-	      xfree (contents);
-
 	      /* Restore the position.  */
 	      bt_iter_set_pos (bt_ctf_get_iter (ctf_iter), pos);