From 884feb7ca30c962742aad758bf16d0d0cb3af4f8 Mon Sep 17 00:00:00 2001 From: Simon Marchi Date: Tue, 5 Dec 2023 04:00:16 +0000 Subject: [PATCH] src.ctf.fs: use ctf_fs_ds_file::UP in add_ds_file_to_ds_file_group Change-Id: I8b7a55f28b746cc6b93bfb4459bfc41789d7d4f2 Signed-off-by: Simon Marchi Reviewed-on: https://review.lttng.org/c/babeltrace/+/8270 Reviewed-by: Philippe Proulx Reviewed-on: https://review.lttng.org/c/babeltrace/+/12308 Tested-by: jenkins --- src/plugins/ctf/fs-src/fs.cpp | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/plugins/ctf/fs-src/fs.cpp b/src/plugins/ctf/fs-src/fs.cpp index 7b16acd9..00985e6d 100644 --- a/src/plugins/ctf/fs-src/fs.cpp +++ b/src/plugins/ctf/fs-src/fs.cpp @@ -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(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); } -- 2.34.1