From 8cd0977a3688fa705c83867c57505a47b9269369 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Sun, 8 Jan 2023 16:34:43 +0000 Subject: Fix up all the static analyzer warnings --- test/testHelpers.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 test/testHelpers.cpp (limited to 'test/testHelpers.cpp') diff --git a/test/testHelpers.cpp b/test/testHelpers.cpp new file mode 100644 index 0000000..c69e5f3 --- /dev/null +++ b/test/testHelpers.cpp @@ -0,0 +1,16 @@ +#include "testHelpers.h" +#include + +std::unique_ptr +uasprintf(const char * fmt, ...) +{ + char * buf {}; + va_list args; + va_start(args, fmt); + if (vasprintf(&buf, fmt, args) < 0) { + va_end(args); + return {nullptr, &free}; + } + va_end(args); + return std::unique_ptr {buf, &free}; +} -- cgit v1.2.3