r7126: fixing paranoid malloc checker failures
authorGerald Carter <jerry@samba.org>
Tue, 31 May 2005 01:44:44 +0000 (01:44 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 15:57:01 +0000 (10:57 -0500)
(This used to be commit b01026674fddb4179a7f002c13f5e341eaaa0a1c)

source3/pam_smbpass/pam_smb_auth.c
source3/pam_smbpass/pam_smb_passwd.c
source3/pam_smbpass/support.c

index d0dca6fa9209f8146f5f15c26faec9c051760be3..74645564d48efff58295e395f60bd51ed8f9c83a 100644 (file)
@@ -82,7 +82,7 @@ int pam_sm_authenticate(pam_handle_t *pamh, int flags,
 
     /* Get a few bytes so we can pass our return value to
        pam_sm_setcred(). */
-    ret_data = malloc(sizeof(int));
+    ret_data = SMB_MALLOC_P(int);
 
     /* get the username */
     retval = pam_get_user( pamh, &name, "Username: " );
index bef587a916cbdfd2bd7c1d823576a9530c2a87a5..8149bc12003b982d55766ee2ba6661447c9bd331 100644 (file)
@@ -169,7 +169,7 @@ int pam_sm_chauthtok(pam_handle_t *pamh, int flags,
 
             /* tell user what is happening */
 #define greeting "Changing password for "
-            Announce = (char *) malloc(sizeof(greeting)+strlen(user));
+            Announce = SMB_MALLOC_ARRAY(char, sizeof(greeting)+strlen(user));
             if (Announce == NULL) {
                 _log_err(LOG_CRIT, "password: out of memory");
                 pdb_free_sam(&sampass);
index 8a0432c85501583b5476092e96373b836174c4df..f5682480ebae7284d8eb286a6528bba541f09069 100644 (file)
@@ -238,7 +238,7 @@ char * smbpXstrDup( const char *x )
         register int i;
 
         for (i = 0; x[i]; ++i); /* length of string */
-        if ((new = malloc(++i)) == NULL) {
+        if ((new = SMB_MALLOC_ARRAY(char, ++i)) == NULL) {
             i = 0;
             _log_err( LOG_CRIT, "out of memory in smbpXstrDup" );
         } else {
@@ -344,7 +344,7 @@ int _smb_verify_password( pam_handle_t * pamh, SAM_ACCOUNT *sampass,
         }
     }
 
-    data_name = (char *) malloc( sizeof(FAIL_PREFIX) + strlen( name ));
+    data_name = SMB_MALLOC_ARRAY(char, sizeof(FAIL_PREFIX) + strlen( name ));
     if (data_name == NULL) {
         _log_err( LOG_CRIT, "no memory for data-name" );
     }
@@ -379,8 +379,7 @@ int _smb_verify_password( pam_handle_t * pamh, SAM_ACCOUNT *sampass,
 
             /* get a failure recorder */
 
-            new = (struct _pam_failed_auth *)
-                      malloc( sizeof(struct _pam_failed_auth) );
+            new = SMB_MALLOC_P( struct _pam_failed_auth );
 
             if (new != NULL) {