[Fedora-directory-commits] ldapserver/ldap/servers/plugins/pam_passthru pam_ptimpl.c, 1.12, 1.13

Noriko Hosoi nhosoi at fedoraproject.org
Wed Oct 15 06:29:59 UTC 2008


Author: nhosoi

Update of /cvs/dirsec/ldapserver/ldap/servers/plugins/pam_passthru
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv25637/ldap/servers/plugins/pam_passthru

Modified Files:
	pam_ptimpl.c 
Log Message:
Resolves: #466702
Summary: Memory usage research: checking in the experimental code
See also: http://directory.fedoraproject.org/wiki/Memory_Usage_Research



Index: pam_ptimpl.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/plugins/pam_passthru/pam_ptimpl.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- pam_ptimpl.c	8 Oct 2008 17:29:02 -0000	1.12
+++ pam_ptimpl.c	15 Oct 2008 06:29:56 -0000	1.13
@@ -77,7 +77,7 @@
 delete_my_str_buf(MyStrBuf *buf)
 {
 	if (buf->str != buf->fixbuf) {
-		slapi_ch_free_string(&buf->str);
+		slapi_ch_free_string(&(buf->str));
 	}
 }
 
@@ -152,7 +152,7 @@
 /* returns a berval value as a null terminated string */
 static char *strdupbv(struct berval *bv)
 {
-	char *str = malloc(bv->bv_len+1);
+	char *str = slapi_ch_malloc(bv->bv_len+1);
 	memcpy(str, bv->bv_val, bv->bv_len);
 	str[bv->bv_len] = 0;
 	return str;
@@ -164,10 +164,10 @@
 	int ii;
 	for (ii = 0; ii < nresp; ++ii) {
 		if (resp[ii].resp) {
-			free(resp[ii].resp);
+			slapi_ch_free((void **)&(resp[ii].resp));
 		}
 	}
-	free(resp);
+	slapi_ch_free((void **)&resp);
 }
 
 /*
@@ -190,7 +190,7 @@
 	}
 
 	/* empty reply structure */
-    reply = (struct pam_response *)calloc(num_msg,
+    reply = (struct pam_response *)slapi_ch_calloc(num_msg,
 										  sizeof(struct pam_response));
 	slapi_pblock_get( my_data->pb, SLAPI_BIND_CREDENTIALS, &creds ); /* the password */
 	for (ii = 0; ii < num_msg; ++ii) {
@@ -206,7 +206,7 @@
 			reply[ii].resp = strdupbv(creds);
 #endif
 		} else if (msg[ii]->msg_style == PAM_PROMPT_ECHO_ON) { /* assume username */
-			reply[ii].resp = strdup(my_data->pam_identity);
+			reply[ii].resp = slapi_ch_strdup(my_data->pam_identity);
 		} else if (msg[ii]->msg_style == PAM_ERROR_MSG) {
 			slapi_log_error(SLAPI_LOG_FATAL, PAM_PASSTHRU_PLUGIN_SUBSYSTEM,
 							"pam msg [%d] error [%s]\n", ii, msg[ii]->msg);




More information about the Fedora-directory-commits mailing list