Windows: validate buffer hash tables in cm_MergeStatus
[openafs.git] / src / WINNT / afsd / cm_scache.c
index db24b4f..687b0cd 100644 (file)
@@ -1646,11 +1646,14 @@ void cm_MergeStatus(cm_scache_t *dscp,
 
                     j = BUF_HASH(&bp->fid, &bp->offset);
                     lbpp = &(cm_data.buf_scacheHashTablepp[j]);
-                    for(tbp = *lbpp; tbp; lbpp = &tbp->hashp, tbp = *lbpp) {
+                    for(tbp = *lbpp; tbp; lbpp = &tbp->hashp, tbp = tbp->hashp) {
                         if (tbp == bp)
                             break;
                     }
 
+                    /* we better find it */
+                    osi_assertx(tbp != NULL, "cm_MergeStatus: buf_scacheHashTablepp table screwup");
+
                     *lbpp = bp->hashp; /* hash out */
                     bp->hashp = NULL;