aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOrgad Shaneh <orgad.shaneh@audiocodes.com>2014-11-21 11:35:51 +0200
committerOrgad Shaneh <orgads@gmail.com>2014-11-24 14:44:50 +0100
commit8f68b7ccbae7b243b6b3f88b12971f6d77085497 (patch)
treeeb60e4e518db632773eccc29b4d62379a7a6dcb9
parent1679c07e745839db357ceb98cfcd58a3147794a5 (diff)
Utils: Fix memory leak in JsonMemoryPool
objects are freed, but their dtors are not called... Detected by valgrind Change-Id: Iec8d78c205e9b2722ee5a89941df96c3383b385b Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com> Reviewed-by: Fawzi Mohamed <fawzi.mohamed@theqtcompany.com>
-rw-r--r--src/libs/utils/json.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/libs/utils/json.cpp b/src/libs/utils/json.cpp
index 203d4b4f4f..75259520bd 100644
--- a/src/libs/utils/json.cpp
+++ b/src/libs/utils/json.cpp
@@ -42,8 +42,10 @@ using namespace Utils;
JsonMemoryPool::~JsonMemoryPool()
{
- foreach (char *obj, _objs)
+ foreach (char *obj, _objs) {
+ reinterpret_cast<JsonValue *>(obj)->~JsonValue();
delete[] obj;
+ }
}
JsonValue::JsonValue(Kind kind)