[Pcsclite-cvs-commit] r416 - trunk/MusclePAM

Ludovic Rousseau rousseau at costa.debian.org
Thu Mar 16 10:43:24 CET 2006


Author: rousseau
Date: 2006-03-16 09:43:23 +0000 (Thu, 16 Mar 2006)
New Revision: 416

Modified:
   trunk/MusclePAM/pam_smartcard.c
Log:
do not cast malloc() return value and #include <stdlib.h>


Modified: trunk/MusclePAM/pam_smartcard.c
===================================================================
--- trunk/MusclePAM/pam_smartcard.c	2006-03-16 09:33:08 UTC (rev 415)
+++ trunk/MusclePAM/pam_smartcard.c	2006-03-16 09:43:23 UTC (rev 416)
@@ -24,6 +24,7 @@
 #define PAM_SM_SESSION
 #define PAM_SM_PASSMSCULong32
 
+#include <stdlib.h>
 #include <security/pam_modules.h>
 #include <syslog.h>
 #include <musclecard.h>
@@ -162,7 +163,7 @@
     if (*p == '@')
       break;
 
-  userid = (unsigned char *) malloc(sizeof(unsigned char) * index + 1 );
+  userid = malloc(sizeof(unsigned char) * index + 1 );
   strncpy(userid, sk_value(emlst, 0), index);
   X509_email_free(emlst);
 
@@ -341,7 +342,7 @@
   openlog(LOGNAME, LOG_CONS | LOG_PID, LOG_AUTHPRIV);
 
   /* init data */
-  sd = (struct secure_data*)malloc(sizeof(struct secure_data));
+  sd = malloc(sizeof(struct secure_data));
   if (sd == NULL) {
     syslog(LOG_CRIT, "not enough free memory");
     return PAM_AUTHINFO_UNAVAIL;
@@ -538,7 +539,7 @@
 	cryptSize = RAND_SIZE;
 
 	struct secure_data *sd2;
-	sd2 = (struct secure_data*)malloc(sizeof(struct secure_data));
+	sd2 = malloc(sizeof(struct secure_data));
 	if (sd2 == NULL) {
 	  syslog(LOG_CRIT, "not enough free memory to initialize sd2");
 	  pam_release_data(sd);
@@ -682,7 +683,7 @@
   }
 
   /* init data */
-  sd = (struct secure_data*)malloc(sizeof(struct secure_data));
+  sd = malloc(sizeof(struct secure_data));
   if (sd == NULL) {
     syslog(LOG_CRIT, "not enough free memory");
     return PAM_AUTHINFO_UNAVAIL;




More information about the Pcsclite-cvs-commit mailing list