]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Initialize mem_node fully
authorAmos Jeffries <squid3@treenet.co.nz>
Mon, 28 Jan 2013 11:41:04 +0000 (04:41 -0700)
committerAmos Jeffries <squid3@treenet.co.nz>
Mon, 28 Jan 2013 11:41:04 +0000 (04:41 -0700)
Experience in squid-2.7 shows that with MemPools use of malloc instead
of calloc mem_node requires full initialization in order to get accurate
memory accounting.

Also closes Coverity Scan defect issue 740573.

src/mem_node.cc

index afac91e7529fc809afc0d0bd28dbe0c2647c2825..d7a5e7d7ccb51e3fba1592af9d80dd295a810194 100644 (file)
@@ -65,8 +65,12 @@ memNodeWriteComplete(void* d)
     n->write_pending = 0;
 }
 
-mem_node::mem_node(int64_t offset):nodeBuffer(0,offset,data)
-{}
+mem_node::mem_node(int64_t offset) :
+        nodeBuffer(0,offset,data),
+        write_pending(0)
+{
+    *data = 0;
+}
 
 mem_node::~mem_node()
 {}