]> git.saurik.com Git - cycript.git/commitdiff
CYPool::str*dup was leaking memory via global new.
authorJay Freeman (saurik) <saurik@saurik.com>
Thu, 26 Nov 2015 05:53:39 +0000 (21:53 -0800)
committerJay Freeman (saurik) <saurik@saurik.com>
Thu, 26 Nov 2015 05:53:39 +0000 (21:53 -0800)
Pooling.hpp

index 1c1f219537f9401efcf4c66e73e6f36cc08a7980..6225392c5b0a3e96edd4b034fc73c161cd6f95ba 100644 (file)
@@ -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<char>(size + 1));
         memcpy(copy, data, size);
         copy[size] = '\0';
         return copy;