From 5d5d70c083c2b891eb5382df084c90b0e2d406e5 Mon Sep 17 00:00:00 2001 From: "Jay Freeman (saurik)" Date: Wed, 25 Nov 2015 21:53:39 -0800 Subject: [PATCH] CYPool::str*dup was leaking memory via global new. --- Pooling.hpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Pooling.hpp b/Pooling.hpp index 1c1f219..6225392 100644 --- a/Pooling.hpp +++ b/Pooling.hpp @@ -115,12 +115,12 @@ class CYPool { return copy; } - char *strndup(const char *data, size_t size) const { + char *strndup(const char *data, size_t size) { return strmemdup(data, strnlen(data, size)); } - char *strmemdup(const char *data, size_t size) const { - char *copy(new char[size + 1]); + char *strmemdup(const char *data, size_t size) { + char *copy(malloc(size + 1)); memcpy(copy, data, size); copy[size] = '\0'; return copy; -- 2.45.2