src.ctf.fs: use ctf_fs_ds_file::UP in add_ds_file_to_ds_file_group
authorSimon Marchi <simon.marchi@efficios.com>
Tue, 5 Dec 2023 04:00:16 +0000 (04:00 +0000)
committerSimon Marchi <simon.marchi@efficios.com>
Wed, 17 Apr 2024 17:57:53 +0000 (13:57 -0400)
Change-Id: I8b7a55f28b746cc6b93bfb4459bfc41789d7d4f2
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/8270
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/12308
Tested-by: jenkins <jenkins@lttng.org>
src/plugins/ctf/fs-src/fs.cpp

index 7b16acd91770f006914ff16021bf299af86a99f1..00985e6d8c45094c709fb6084207815aac698a2d 100644 (file)
@@ -512,7 +512,6 @@ static int add_ds_file_to_ds_file_group(struct ctf_fs_trace *ctf_fs_trace, const
     struct ctf_fs_ds_file_group *ds_file_group = NULL;
     ctf_fs_ds_file_group::UP new_ds_file_group;
     int ret;
-    struct ctf_fs_ds_file *ds_file = NULL;
     ctf_fs_ds_file_info::UP ds_file_info;
     ctf_fs_ds_index::UP index;
     struct ctf_msg_iter *msg_iter = NULL;
@@ -523,9 +522,8 @@ static int add_ds_file_to_ds_file_group(struct ctf_fs_trace *ctf_fs_trace, const
      * Create a temporary ds_file to read some properties about the data
      * stream file.
      */
-    ds_file =
-        ctf_fs_ds_file_create(ctf_fs_trace, bt2::Stream::Shared {}, path, ctf_fs_trace->logger)
-            .release();
+    const auto ds_file =
+        ctf_fs_ds_file_create(ctf_fs_trace, bt2::Stream::Shared {}, path, ctf_fs_trace->logger);
     if (!ds_file) {
         goto error;
     }
@@ -534,7 +532,7 @@ static int add_ds_file_to_ds_file_group(struct ctf_fs_trace *ctf_fs_trace, const
     msg_iter = ctf_msg_iter_create(
         ctf_fs_trace->metadata->tc,
         bt_common_get_page_size(static_cast<int>(ctf_fs_trace->logger.level())) * 8,
-        ctf_fs_ds_file_medops, ds_file, nullptr, ctf_fs_trace->logger);
+        ctf_fs_ds_file_medops, ds_file.get(), nullptr, ctf_fs_trace->logger);
     if (!msg_iter) {
         BT_CPPLOGE_STR_SPEC(ctf_fs_trace->logger, "Cannot create a CTF message iterator.");
         goto error;
@@ -573,7 +571,7 @@ static int add_ds_file_to_ds_file_group(struct ctf_fs_trace *ctf_fs_trace, const
         goto error;
     }
 
-    index = ctf_fs_ds_file_build_index(ds_file, ds_file_info.get(), msg_iter);
+    index = ctf_fs_ds_file_build_index(ds_file.get(), ds_file_info.get(), msg_iter);
     if (!index) {
         BT_CPPLOGE_APPEND_CAUSE_SPEC(ctf_fs_trace->logger, "Failed to index CTF stream file \'{}\'",
                                      ds_file->file->path);
@@ -641,8 +639,6 @@ error:
     ret = -1;
 
 end:
-    delete ds_file;
-
     if (msg_iter) {
         ctf_msg_iter_destroy(msg_iter);
     }
This page took 0.025835 seconds and 4 git commands to generate.