From: Amos Jeffries Date: Tue, 15 Jan 2013 01:01:30 +0000 (-0700) Subject: Initialize mem_node fully X-Git-Tag: SQUID_3_4_0_1~375 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=20ff3738dbfa491b02ca016a6161b64ec7068d45;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() {}