From: Amos Jeffries Date: Tue, 22 Jan 2013 11:07:36 +0000 (-0700) Subject: Initialize mem_node fully X-Git-Tag: SQUID_3_3_1~31 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d925faee3f821fc3e3b248a6a1739d191ff6d9c9;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 16412ed0f0..dc59c3049f 100644 --- a/src/mem_node.cc +++ b/src/mem_node.cc @@ -63,8 +63,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() {}