viced-accurately-track-file-callbacks-20071112
authorJeffrey Altman <jaltman@secure-endpoints.com>
Mon, 12 Nov 2007 19:03:15 +0000 (19:03 +0000)
committerDerrick Brashear <shadow@dementia.org>
Mon, 12 Nov 2007 19:03:15 +0000 (19:03 +0000)
FIXES 74708

this should fix the issue with cbfree being corrupted. a more exhaustive pointer-blunting patch should probably be pulled in, but, this is simple and obvious

src/viced/callback.c

index 8629d92..de59759 100644 (file)
@@ -381,7 +381,7 @@ CDelPtr(register struct FileEntry *fe, register afs_uint32 * cbp,
        CcdelB++;
     *cbp = cb->cnext;
     FreeCB(cb);
-    if (deletefe && (--fe->ncbs == 0))
+    if ((--fe->ncbs == 0) && deletefe)
        FDel(fe);
     return 0;
 }
@@ -922,6 +922,7 @@ DeleteFileCallBacks(AFSFid * fid)
        TDel(cb);
        HDel(cb);
        FreeCB(cb);
+       fe->ncbs--;
     }
     FDel(fe);
     H_UNLOCK;