From: Amos Jeffries Date: Mon, 28 Jan 2013 11:41:04 +0000 (-0700) Subject: Initialize mem_node fully X-Git-Tag: SQUID_3_2_7~9 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6aae5e33d1a3d484ef78e8b423387dcadeb10ab5;p=thirdparty%2Fsquid.git Initialize mem_node fully 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. --- diff --git a/src/mem_node.cc b/src/mem_node.cc index afac91e752..d7a5e7d7cc 100644 --- a/src/mem_node.cc +++ b/src/mem_node.cc @@ -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() {}