stifle-valgrind-20030515
authorNathan Neulinger <nneul@umr.edu>
Thu, 15 May 2003 18:10:39 +0000 (18:10 +0000)
committerDerrick Brashear <shadow@dementia.org>
Thu, 15 May 2003 18:10:39 +0000 (18:10 +0000)
FIXES 1379

shut up valgrind on zeroing allocations

src/auth/authcon.c
src/auth/ktc.c
src/des/des.c
src/viced/callback.c

index f532e45..2935863 100644 (file)
@@ -110,6 +110,7 @@ rxkad_level enclevel; {
     
     /* now create the actual ticket */
     ticketLen = sizeof(tbuffer);
+    memset(tbuffer, '\0', sizeof(tbuffer));
     code = tkt_MakeTicket(tbuffer, &ticketLen, &key, AUTH_SUPERUSER, "", "", 0,
                           0xffffffff, &session, 0, "afs", "");
     /* parms were buffer, ticketlen, key to seal ticket with, principal
index 52fe63e..2c38483 100644 (file)
@@ -656,6 +656,8 @@ struct ktc_principal *aserver; {
     register char *tp;
     afs_int32 temp, index;
 
+    memset(tbuffer, 0, sizeof(tbuffer));
+
     LOCK_GLOBAL_MUTEX
 #ifndef NO_AFS_CLIENT
     TRY_KERNEL (KTC_LISTTOKENS_OP, aserver, aprevIndex, aindex, 0);
index 20f79f1..63ab006 100644 (file)
@@ -75,8 +75,8 @@ afs_int32 des_ecb_encrypt(afs_uint32 *clear, afs_uint32 *cipher,
 {
     /* better pass 8 bytes, length not checked here */
 
-    register afs_uint32 R1, L1; /* R1 = r10, L1 = r9 */
-    register afs_uint32 R2, L2; /* R2 = r8, L2 = r7 */
+    register afs_uint32 R1 = 0, L1 = 0; /* R1 = r10, L1 = r9 */
+    register afs_uint32 R2 = 0, L2 = 0; /* R2 = r8, L2 = r7 */
     afs_int32 i;
     /* one more registers left on VAX, see below P_temp_p */
 #ifdef BITS16
index 441d087..086a5b2 100644 (file)
@@ -518,7 +518,7 @@ int InitCallBack(int nblks)
     tfirst = CBtime(FT_ApproxTime());
     /* N.B. The "-1", below, is because
       FE[0] and CB[0] are not used--and not allocated */
-    FE = ((struct FileEntry *)(malloc(sizeof(struct FileEntry)*nblks)))-1;
+    FE = ((struct FileEntry *)(calloc(nblks, sizeof(struct FileEntry))))-1;
     if (!FE) {
        ViceLog(0, ("Failed malloc in InitCallBack\n"));
        assert(0);
@@ -526,7 +526,7 @@ int InitCallBack(int nblks)
     cbstuff.nFEs = nblks;
     while (cbstuff.nFEs)
        FreeFE(&FE[cbstuff.nFEs]); /* This is correct */
-    CB = ((struct CallBack *)(malloc(sizeof(struct CallBack)*nblks)))-1;
+    CB = ((struct CallBack *)(calloc(nblks, sizeof(struct CallBack))))-1;
     if (!CB) {
        ViceLog(0, ("Failed malloc in InitCallBack\n"));
        assert(0);
@@ -1688,8 +1688,8 @@ time_t ReadDump(char *file)
     read(fd, timeout, sizeof(timeout));
     read(fd, &tfirst, sizeof(tfirst));
     read(fd, &freelisthead, sizeof(freelisthead));
-    CB = ((struct CallBack *)(malloc(sizeof(struct FileEntry)*cbstuff.nblks)))-1;
-    FE = ((struct FileEntry *)(malloc(sizeof(struct FileEntry)*cbstuff.nblks)))-1;
+    CB = ((struct CallBack *)(calloc(cbstuff.nblks,sizeof(struct FileEntry))))-1;
+    FE = ((struct FileEntry *)(calloc(cbstuff.nblks,sizeof(struct FileEntry))))-1;
     CBfree = (struct CallBack *) itocb(freelisthead);
     read(fd, &freelisthead, sizeof(freelisthead));
     FEfree = (struct FileEntry *) itofe(freelisthead);
@@ -1874,8 +1874,8 @@ int MultiBreakCallBackAlternateAddress_r(struct host *host, struct AFSCBFids *af
            sc = rxnull_NewClientSecurityObject();
 
        i = host->interface->numberOfInterfaces;
-       addr = malloc(i * sizeof(afs_int32));
-       conns = malloc(i * sizeof(struct rx_connection *));
+       addr = calloc(i, sizeof(afs_int32));
+       conns = calloc(i, sizeof(struct rx_connection *));
        if (!addr || !conns) {
            ViceLog(0, ("Failed malloc in MultiBreakCallBackAlternateAddress_r\n"));
            assert(0);
@@ -1962,8 +1962,8 @@ int MultiProbeAlternateAddress_r(struct host *host)
            sc = rxnull_NewClientSecurityObject();
 
        i = host->interface->numberOfInterfaces;
-       addr = malloc(i * sizeof(afs_int32));   
-       conns = malloc(i * sizeof(struct rx_connection *));
+       addr = calloc(i, sizeof(afs_int32));    
+       conns = calloc(i, sizeof(struct rx_connection *));
        if (!addr || !conns) {
            ViceLog(0, ("Failed malloc in MultiProbeAlternateAddress_r\n"));
            assert(0);