From: Garrett Wollman Date: Sat, 13 Aug 2011 22:51:02 +0000 (-0400) Subject: libafs: don't call afs_PutDCache(NULL) in afs_GetDownD() X-Git-Tag: openafs-devel-1_7_1~141 X-Git-Url: https://git.openafs.org/?p=openafs.git;a=commitdiff_plain;h=10d27341808be41b29fbcc09b8bd7523c3b7a541 libafs: don't call afs_PutDCache(NULL) in afs_GetDownD() It's possible for an eviction candidate to be omitted by the small for loop (around line 670), leaving its reference in victimDCs set to NULL. In the big for loop that follows, don't call afs_PutDCache() when we hit one. Change-Id: Ib0891636a3479bf97cdeab823189e659cb261aa6 Found-by: clang static analyzer with help from AFS_NONNULL Reviewed-on: http://gerrit.openafs.org/5260 Tested-by: BuildBot Reviewed-by: Derrick Brashear --- diff --git a/src/afs/afs_dcache.c b/src/afs/afs_dcache.c index 3d6f2d1..da56b7c 100644 --- a/src/afs/afs_dcache.c +++ b/src/afs/afs_dcache.c @@ -837,7 +837,8 @@ afs_GetDownD(int anumber, int *aneedSpace, afs_int32 buckethint) j = 1; /* we reclaimed at least one victim */ } } - afs_PutDCache(tdc); + if (tdc) + afs_PutDCache(tdc); } /* end of for victims loop */ if (phase < 5) {