[CalendarServer-changes] [5282] PyOpenDirectory/trunk

source_changes at macosforge.org source_changes at macosforge.org
Wed Mar 10 10:44:37 PST 2010


Revision: 5282
          http://trac.macosforge.org/projects/calendarserver/changeset/5282
Author:   wsanchez at apple.com
Date:     2010-03-10 10:44:37 -0800 (Wed, 10 Mar 2010)
Log Message:
-----------
Merge http://svn.calendarserver.org/repository/calendarserver/PyOpenDirectory/branches/users/gaya/attrmemleaks: avoid leak of od references

Modified Paths:
--------------
    PyOpenDirectory/trunk/src/CDirectoryService.cpp

Property Changed:
----------------
    PyOpenDirectory/trunk/


Property changes on: PyOpenDirectory/trunk
___________________________________________________________________
Modified: svn:mergeinfo
   - /PyOpenDirectory/branches/users/cdaboo/datatypes-3001:3002-3058
/PyOpenDirectory/branches/users/gaya/addigestauth:4592-4826
   + /PyOpenDirectory/branches/users/cdaboo/datatypes-3001:3002-3058
/PyOpenDirectory/branches/users/gaya/addigestauth:4592-4826
/PyOpenDirectory/branches/users/gaya/attrmemleaks:4897-5281

Modified: PyOpenDirectory/trunk/src/CDirectoryService.cpp
===================================================================
--- PyOpenDirectory/trunk/src/CDirectoryService.cpp	2010-03-10 18:09:23 UTC (rev 5281)
+++ PyOpenDirectory/trunk/src/CDirectoryService.cpp	2010-03-10 18:44:37 UTC (rev 5282)
@@ -345,6 +345,8 @@
     tDataListPtr attrTypes = NULL;
     tContextData context = NULL;
     tAttributeListRef attrListRef = 0L;
+	tAttributeValueListRef attributeValueListRef = 0L;
+	tAttributeEntryPtr attributeInfoPtr = NULL;
 	
     try
     {
@@ -377,8 +379,6 @@
             ThrowIfDSErr(err);
             for(UInt32 i = 1; i <= attrCount; i++)
             {
-				tAttributeValueListRef attributeValueListRef = NULL;
-				tAttributeEntryPtr attributeInfoPtr = NULL;
 				
 				ThrowIfDSErr(::dsGetAttributeEntry(node, mData, attrListRef, i, &attributeValueListRef, &attributeInfoPtr));
 				
@@ -457,6 +457,10 @@
     catch(CDirectoryServiceException& dsStatus)
     {
         // Cleanup
+        if (attributeValueListRef != 0L)
+			::dsCloseAttributeValueList(attributeValueListRef);
+        if (attributeInfoPtr != NULL)
+			::dsDeallocAttributeEntry(mDir, attributeInfoPtr);
         if (context != NULL)
             ::dsReleaseContinueData(mDir, context);
 		
@@ -515,6 +519,8 @@
     tContextData context = NULL;
     tAttributeListRef attrListRef = 0L;
     tRecordEntry* pRecEntry = NULL;
+	tAttributeValueListRef attributeValueListRef = 0L;
+	tAttributeEntryPtr attributeInfoPtr = NULL;
 
     // Must have attributes
     if (::CFDictionaryGetCount(attributes) == 0)
@@ -579,9 +585,6 @@
                 // Look at each requested attribute and get one value
                 for(unsigned long j = 1; j <= pRecEntry->fRecordAttributeCount; j++)
                 {
-                    tAttributeValueListRef attributeValueListRef = NULL;
-                    tAttributeEntryPtr attributeInfoPtr = NULL;
-
                     ThrowIfDSErr(::dsGetAttributeEntry(mNode, mData, attrListRef, j, &attributeValueListRef, &attributeInfoPtr));
 
                     if (attributeInfoPtr->fAttributeValueCount > 0)
@@ -681,6 +684,10 @@
     catch(CDirectoryServiceException& dsStatus)
     {
         // Cleanup
+        if (attributeValueListRef != 0L)
+			::dsCloseAttributeValueList(attributeValueListRef);
+        if (attributeInfoPtr != NULL)
+			::dsDeallocAttributeEntry(mDir, attributeInfoPtr);
         if (context != NULL)
             ::dsReleaseContinueData(mDir, context);
         if (attrListRef != 0L)
@@ -765,7 +772,10 @@
     tContextData context = NULL;
     tAttributeListRef attrListRef = 0L;
     tRecordEntry* pRecEntry = NULL;
+	tAttributeValueListRef attributeValueListRef = 0L;
+	tAttributeEntryPtr attributeInfoPtr = NULL;
 
+
     // Must have attributes
     if (::CFDictionaryGetCount(attributes) == 0)
         return NULL;
@@ -846,9 +856,6 @@
                 // Look at each requested attribute and get one value
                 for(unsigned long j = 1; j <= pRecEntry->fRecordAttributeCount; j++)
                 {
-                    tAttributeValueListRef attributeValueListRef = NULL;
-                    tAttributeEntryPtr attributeInfoPtr = NULL;
-
                     ThrowIfDSErr(::dsGetAttributeEntry(mNode, mData, attrListRef, j, &attributeValueListRef, &attributeInfoPtr));
 
                     if (attributeInfoPtr->fAttributeValueCount > 0)
@@ -947,6 +954,10 @@
     catch(CDirectoryServiceException& dsStatus)
     {
         // Cleanup
+        if (attributeValueListRef != 0L)
+			::dsCloseAttributeValueList(attributeValueListRef);
+        if (attributeInfoPtr != NULL)
+			::dsDeallocAttributeEntry(mDir, attributeInfoPtr);
         if (context != NULL)
             ::dsReleaseContinueData(mDir, context);
         if (attrListRef != 0L)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20100310/046e0af6/attachment.html>


More information about the calendarserver-changes mailing list