Use std::string in rust_get_disr_info
authorTom Tromey <tom@tromey.com>
Wed, 9 Nov 2016 03:22:29 +0000 (20:22 -0700)
committerTom Tromey <tom@tromey.com>
Sat, 12 Nov 2016 17:34:46 +0000 (10:34 -0700)
This changes rust_get_disr_info to use std::string in one more spot,
avoiding a memory leak.

2016-11-12  Tom Tromey  <tom@tromey.com>

* rust-lang.c (rust_get_disr_info): Use std::string in one more
spot.

gdb/ChangeLog
gdb/rust-lang.c

index 99edafc..1f32c02 100644 (file)
@@ -1,3 +1,8 @@
+2016-11-12  Tom Tromey  <tom@tromey.com>
+
+       * rust-lang.c (rust_get_disr_info): Use std::string in one more
+       spot.
+
 2016-11-11  Yao Qi  <yao.qi@linaro.org>
 
        * spu-tdep.c (spu_software_single_step): Don't call
index 295dae1..7d4bfc3 100644 (file)
@@ -222,7 +222,7 @@ rust_get_disr_info (struct type *type, const gdb_byte *valaddr,
          with the first field being the actual type works.  */
       const char *field_name = TYPE_NAME (TYPE_FIELD_TYPE (type, 0));
       const char *last = rust_last_path_segment (field_name);
-      ret.name = concat (TYPE_NAME (type), "::", last, (char *) NULL);
+      ret.name = std::string (TYPE_NAME (type)) + "::" + last;
       ret.field_no = RUST_ENCODED_ENUM_REAL;
       ret.is_encoded = 1;
       return ret;