[Fedora-directory-commits] winsync/passwordsync/passsync dssynch.h, 1.6, 1.7 syncserv.cpp, 1.11, 1.12

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


Author: nkinder

Update of /cvs/dirsec/winsync/passwordsync/passsync
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv12256/passwordsync/passsync

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


Index: dssynch.h
===================================================================
RCS file: /cvs/dirsec/winsync/passwordsync/passsync/dssynch.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- dssynch.h	11 Oct 2005 15:40:35 -0000	1.6
+++ dssynch.h	18 Mar 2006 00:36:39 -0000	1.7
@@ -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/winsync/passwordsync/passsync/syncserv.cpp,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- syncserv.cpp	14 Oct 2005 17:58:19 -0000	1.11
+++ syncserv.cpp	18 Mar 2006 00:36:39 -0000	1.12
@@ -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