trafficserver-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jpe...@apache.org
Subject [1/2] trafficserver git commit: Fix DiskVol pointer array allocation
Date Tue, 06 Jan 2015 23:26:59 GMT
Repository: trafficserver
Updated Branches:
  refs/heads/master 82f95638c -> 15e70572d


Fix DiskVol pointer array allocation

Coverity CID #1022100
Coverity CID #1022099


Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/15e70572
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/15e70572
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/15e70572

Branch: refs/heads/master
Commit: 15e70572df17c502041e9775feeb8beb416f7a11
Parents: 70aec04
Author: James Peach <jpeach@apache.org>
Authored: Mon Jan 5 09:53:27 2015 -0800
Committer: James Peach <jpeach@apache.org>
Committed: Tue Jan 6 15:22:45 2015 -0800

----------------------------------------------------------------------
 iocore/cache/CacheDisk.cc | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/15e70572/iocore/cache/CacheDisk.cc
----------------------------------------------------------------------
diff --git a/iocore/cache/CacheDisk.cc b/iocore/cache/CacheDisk.cc
index a4b4a48..b2ed592 100644
--- a/iocore/cache/CacheDisk.cc
+++ b/iocore/cache/CacheDisk.cc
@@ -49,8 +49,7 @@ CacheDisk::open(char *s, off_t blocks, off_t askip, int ahw_sector_size,
int fil
     start = skip + header_len;
   }
 
-  disk_vols = (DiskVol **)ats_malloc((l / MIN_VOL_SIZE + 1) * sizeof(DiskVol **));
-  memset(disk_vols, 0, (l / MIN_VOL_SIZE + 1) * sizeof(DiskVol **));
+  disk_vols = (DiskVol **)ats_calloc((l / MIN_VOL_SIZE + 1), sizeof(DiskVol *));
   header_len = ROUND_TO_STORE_BLOCK(header_len);
   start = skip + header_len;
   num_usable_blocks = (off_t(len * STORE_BLOCK_SIZE) - (start - askip)) >> STORE_BLOCK_SHIFT;


Mime
View raw message