diff options
author | Loek Le Blansch <loek@pipeframe.xyz> | 2024-10-30 16:43:22 +0100 |
---|---|---|
committer | Loek Le Blansch <loek@pipeframe.xyz> | 2024-10-30 16:43:22 +0100 |
commit | 504d231429e2a5d2b31a876645b590bb4a6a03f6 (patch) | |
tree | 415c7d89cfcc8cdb5802a9ae0bdbd1bb71ca823c /backend/util.hpp | |
parent | 71380426426dffe787d1704a8fd639c4b1bbfad3 (diff) |
WIP battle the memory leaks
Diffstat (limited to 'backend/util.hpp')
-rw-r--r-- | backend/util.hpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/backend/util.hpp b/backend/util.hpp new file mode 100644 index 0000000..2d9e76a --- /dev/null +++ b/backend/util.hpp @@ -0,0 +1,11 @@ +#pragma once + +#include "util.h" + +template <typename T> +void safe_free(List<T *> & ptr_list) { + for (T * obj : ptr_list) + delete obj; + ptr_list.clear(); +} + |