From 77cc18420a2866614fc5570b38baeb37191dd2ba Mon Sep 17 00:00:00 2001 From: Vitaliy Filippov Date: Sun, 16 Jan 2022 00:11:59 +0300 Subject: [PATCH] Fix leaks detected by clang scan-build (only 1 of 4 may be important though) --- src/fio_engine.cpp | 1 + src/fio_sec_osd.cpp | 1 + src/nbd_proxy.cpp | 1 + src/osd_primary_chain.cpp | 1 + src/stub_osd.cpp | 1 - 5 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/fio_engine.cpp b/src/fio_engine.cpp index a3efd5d0..9b1904d4 100644 --- a/src/fio_engine.cpp +++ b/src/fio_engine.cpp @@ -228,6 +228,7 @@ static enum fio_q_status bs_queue(struct thread_data *td, struct io_u *io) break; default: io->error = EINVAL; + delete op; return FIO_Q_COMPLETED; } diff --git a/src/fio_sec_osd.cpp b/src/fio_sec_osd.cpp index 0d0f6c33..6a948532 100644 --- a/src/fio_sec_osd.cpp +++ b/src/fio_sec_osd.cpp @@ -284,6 +284,7 @@ static enum fio_q_status sec_queue(struct thread_data *td, struct io_u *io) break; default: io->error = EINVAL; + delete op_buf; return FIO_Q_COMPLETED; } diff --git a/src/nbd_proxy.cpp b/src/nbd_proxy.cpp index df66ae51..6fbaf0e0 100644 --- a/src/nbd_proxy.cpp +++ b/src/nbd_proxy.cpp @@ -734,5 +734,6 @@ int main(int narg, const char *args[]) exe_name = args[0]; nbd_proxy *p = new nbd_proxy(); p->exec(nbd_proxy::parse_args(narg, args)); + delete p; return 0; } diff --git a/src/osd_primary_chain.cpp b/src/osd_primary_chain.cpp index 0329c12a..9ed1c003 100644 --- a/src/osd_primary_chain.cpp +++ b/src/osd_primary_chain.cpp @@ -207,6 +207,7 @@ int osd_t::submit_bitmap_subops(osd_op_t *cur_op, pg_t & pg) std::vector *bitmap_requests = new std::vector(); if (collect_bitmap_requests(cur_op, pg, *bitmap_requests) < 0) { + delete bitmap_requests; return -1; } op_data->n_subops = 0; diff --git a/src/stub_osd.cpp b/src/stub_osd.cpp index 4f937f1e..4e2fa5c2 100644 --- a/src/stub_osd.cpp +++ b/src/stub_osd.cpp @@ -166,5 +166,4 @@ void run_stub(int peer_fd) break; } } - free(buf); }