From f3e88766278405982bde654e03e722ac5ca54366 Mon Sep 17 00:00:00 2001 From: Niklas Eiling Date: Thu, 3 Sep 2020 17:19:08 +0200 Subject: [PATCH] fix memory leak error in lib/nodes/exec.cpp and lib/nodes/opal.cpp --- lib/nodes/exec.cpp | 2 +- lib/nodes/opal.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/nodes/exec.cpp b/lib/nodes/exec.cpp index a2e902f26..f7ca0c4d7 100644 --- a/lib/nodes/exec.cpp +++ b/lib/nodes/exec.cpp @@ -232,7 +232,7 @@ int exec_write(struct vnode *n, struct sample *smps[], unsigned cnt, unsigned *r if (e->flush) e->proc->cout().flush(); - delete line; + delete[] line; return cnt; } diff --git a/lib/nodes/opal.cpp b/lib/nodes/opal.cpp index d333da439..e52a1f0d0 100644 --- a/lib/nodes/opal.cpp +++ b/lib/nodes/opal.cpp @@ -128,8 +128,8 @@ int opal_print_global() { debug(LOG_OPAL | 2, "Controller ID: %u", params.controllerID); - auto *sbuf = new char[send_icons * 5]; - auto *rbuf = new char[recv_icons * 5]; + auto *sbuf = new (std::nothrow) char[send_icons * 5]; + auto *rbuf = new (std::nothrow) char[recv_icons * 5]; if (!sbuf || !rbuf) throw MemoryAllocationError();