[Fedora-directory-commits] ldapserver/ldap/synctools/passwordsync/passsync dssynch.h, 1.5.2.1, 1.5.2.2 syncserv.cpp, 1.7.2.4, 1.7.2.5

Nathan Kinder (nkinder) fedora-directory-commits at redhat.com
Sat Mar 18 00:32:18 UTC 2006


Author: nkinder

Update of /cvs/dirsec/ldapserver/ldap/synctools/passwordsync/passsync
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv12158/ldap/synctools/passwordsync/passsync

Modified Files:
      Tag: Directory71RtmBranch
	dssynch.h syncserv.cpp 
Log Message:
186765 - Fixed memory leaks in passsync service


Index: dssynch.h
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/synctools/passwordsync/passsync/dssynch.h,v
retrieving revision 1.5.2.1
retrieving revision 1.5.2.2
diff -u -r1.5.2.1 -r1.5.2.2
--- dssynch.h	11 Oct 2005 15:56:01 -0000	1.5.2.1
+++ dssynch.h	18 Mar 2006 00:32:01 -0000	1.5.2.2
@@ -65,6 +65,6 @@
 #define DS_SERVICE_NAME_UNI L"Netscape Directory Synchronization Service"
 #define DS_EVENT_NAME TEXT("Netscape DirSynch")
 #define DSS_TERM_EVENT TEXT("NS_DSSYNCH")
-#define SYNCH_VERSION "1.0.1"
+#define SYNCH_VERSION "1.0.2"
 
 #endif // _DSSYNCH_H_


Index: syncserv.cpp
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/synctools/passwordsync/passsync/syncserv.cpp,v
retrieving revision 1.7.2.4
retrieving revision 1.7.2.5
diff -u -r1.7.2.4 -r1.7.2.5
--- syncserv.cpp	14 Oct 2005 17:59:01 -0000	1.7.2.4
+++ syncserv.cpp	18 Mar 2006 00:32:01 -0000	1.7.2.5
@@ -242,6 +242,7 @@
 	}
 
 exit:
+	clearSet(&passInfoList);
 	CloseHandle(passhookEventHandle);
 }
 
@@ -254,7 +255,7 @@
 	PASS_INFO_LIST emptyPassInfoList;
 	PASS_INFO_LIST_ITERATOR currentPassInfo;
 	PASS_INFO_LIST_ITERATOR tempPassInfo;
-	char* dn;
+	char* dn = NULL;
 	int tempSize = passInfoList.size();
 
 	if(loadSet(&passInfoList, dataFilename) == 0)
@@ -349,6 +350,9 @@
 					timeStamp(&outLog);
 					outLog << "Deferring password change for " << currentPassInfo->username << endl;
 					currentPassInfo++;
+					// free dn
+					ldap_memfree(dn);
+					dn = NULL;
 					continue;
 				}
 				else
@@ -366,6 +370,16 @@
 					timeStamp(&outLog);
 					outLog << "Removing password change from list" << endl;
 				}
+
+				// free the dn
+				ldap_memfree(dn);
+				dn = NULL;
+
+				// free the username and password
+				free(tempPassInfo->username);
+				free(tempPassInfo->password);
+
+				// remove the completed change from the list
 				passInfoList.erase(tempPassInfo);
 			}
 		}
@@ -447,7 +461,10 @@
 	int result = 0;
 	char searchFilter[SYNCSERV_BUF_SIZE];
 
-	results = NULL;
+	if (results != NULL) {
+		ldap_msgfree(results);
+		results = NULL;
+	}
 
 	_snprintf(searchFilter, SYNCSERV_BUF_SIZE, "(%s=%s)", ldapUsernameField, username);
 
@@ -640,6 +657,12 @@
 
 			tempPassInfo = currentPassInfo;
 			currentPassInfo++;
+
+			// free the username and password
+			free(tempPassInfo->username);
+			free(tempPassInfo->password);
+
+			// remove the change from the list
 			passInfoList.erase(tempPassInfo);
 		}
 		else




More information about the Fedora-directory-commits mailing list