r4055: fixed more places to use type safe allocation macros
[bbaumbach/samba-autobuild/.git] / source4 / auth / pampass.c
index a5c9a5de16ae4b4f3bd3bce8e94b63622d9b4222..8612aa9ac0b44e035d65addc4019983fa0c02a8b 100644 (file)
@@ -130,7 +130,7 @@ static int smb_pam_conv(int num_msg,
                return PAM_CONV_ERR;
        }
 
-       reply = malloc(sizeof(struct pam_response) * num_msg);
+       reply = malloc_array_p(struct pam_response, num_msg);
        if (!reply)
                return PAM_CONV_ERR;
 
@@ -210,7 +210,7 @@ static struct chat_struct *make_pw_chat(char *p)
        struct chat_struct *t;
 
        while (1) {
-               t = (struct chat_struct *)malloc(sizeof(*t));
+               t = malloc_p(struct chat_struct);
                if (!t) {
                        DEBUG(0,("make_pw_chat: malloc failed!\n"));
                        return NULL;
@@ -289,7 +289,7 @@ static int smb_pam_passchange_conv(int num_msg,
                return PAM_CONV_ERR;
        }
 
-       reply = malloc(sizeof(struct pam_response) * num_msg);
+       reply = malloc_array_p(struct pam_response, num_msg);
        if (!reply) {
                DEBUG(0,("smb_pam_passchange_conv: malloc for reply failed!\n"));
                free_pw_chat(pw_chat);
@@ -405,8 +405,8 @@ static void smb_free_pam_conv(struct pam_conv *pconv)
 static struct pam_conv *smb_setup_pam_conv(smb_pam_conv_fn smb_pam_conv_fnptr, const char *user,
                                        const char *passwd, const char *newpass)
 {
-       struct pam_conv *pconv = (struct pam_conv *)malloc(sizeof(struct pam_conv));
-       struct smb_pam_userdata *udp = (struct smb_pam_userdata *)malloc(sizeof(struct smb_pam_userdata));
+       struct pam_conv *pconv = malloc_p(struct pam_conv);
+       struct smb_pam_userdata *udp = malloc_p(struct smb_pam_userdata);
 
        if (pconv == NULL || udp == NULL) {
                SAFE_FREE(pconv);