diff -c /Users/bartolome/Downloads/python-ldap-2.3.5/Modules/LDAPObject.c /Users/bartolome/Downloads/python-ldap-2.3.5 2/Modules/LDAPObject.c
*** /Users/bartolome/Downloads/python-ldap-2.3.5/Modules/LDAPObject.c	2008-03-20 05:24:56.000000000 -0700
--- /Users/bartolome/Downloads/python-ldap-2.3.5 2/Modules/LDAPObject.c	2008-08-26 20:32:17.000000000 -0700
***************
*** 77,90 ****
      Py_ssize_t i;
  
      if (lm->mod_type)
! 	PyMem_DEL(lm->mod_type);
      if (lm->mod_bvalues) {
  	for (i = 0; lm->mod_bvalues[i]; i++) {
! 	    PyMem_DEL(lm->mod_bvalues[i]);
  	}
! 	PyMem_DEL(lm->mod_bvalues);
      }
!     PyMem_DEL(lm);
  }
  
  /* 
--- 77,90 ----
      Py_ssize_t i;
  
      if (lm->mod_type)
! 	PyObject_Del(lm->mod_type);
      if (lm->mod_bvalues) {
  	for (i = 0; lm->mod_bvalues[i]; i++) {
! 	    PyObject_Del(lm->mod_bvalues[i]);
  	}
! 	PyObject_Del(lm->mod_bvalues);
      }
!     PyObject_Del(lm);
  }
  
  /* 
***************
*** 123,129 ****
  		return NULL;
      }
  
!     lm = PyMem_NEW(LDAPMod, 1);
      if (lm == NULL)
  	goto nomem;
  
--- 123,129 ----
  		return NULL;
      }
  
!     lm = PyObject_New(LDAPMod, 1);
      if (lm == NULL)
  	goto nomem;
  
***************
*** 131,137 ****
      lm->mod_bvalues = NULL;
  
      len = strlen(type);
!     lm->mod_type = PyMem_NEW(char, len + 1);
      if (lm->mod_type == NULL)
  	goto nomem;
      memcpy(lm->mod_type, type, len + 1);
--- 131,137 ----
      lm->mod_bvalues = NULL;
  
      len = strlen(type);
!     lm->mod_type = PyObject_New(char, len + 1);
      if (lm->mod_type == NULL)
  	goto nomem;
      memcpy(lm->mod_type, type, len + 1);
***************
*** 140,149 ****
  	/* None indicates a NULL mod_bvals */
      } else if (PyString_Check(list)) {
  	/* Single string is a singleton list */
! 	lm->mod_bvalues = PyMem_NEW(struct berval *, 2);
  	if (lm->mod_bvalues == NULL)
  		goto nomem;
! 	lm->mod_bvalues[0] = PyMem_NEW(struct berval, 1);
  	if (lm->mod_bvalues[0] == NULL)
  		goto nomem;
  	lm->mod_bvalues[1] = NULL;
--- 140,149 ----
  	/* None indicates a NULL mod_bvals */
      } else if (PyString_Check(list)) {
  	/* Single string is a singleton list */
! 	lm->mod_bvalues = PyObject_New(struct berval *, 2);
  	if (lm->mod_bvalues == NULL)
  		goto nomem;
! 	lm->mod_bvalues[0] = PyObject_New(struct berval, 1);
  	if (lm->mod_bvalues[0] == NULL)
  		goto nomem;
  	lm->mod_bvalues[1] = NULL;
***************
*** 151,161 ****
  	lm->mod_bvalues[0]->bv_val = PyString_AsString(list);
      } else if (PySequence_Check(list)) {
  	nstrs = PySequence_Length(list);
! 	lm->mod_bvalues = PyMem_NEW(struct berval *, nstrs + 1);
  	if (lm->mod_bvalues == NULL)
  		goto nomem;
  	for (i = 0; i < nstrs; i++) {
! 	   lm->mod_bvalues[i] = PyMem_NEW(struct berval, 1);
  	   if (lm->mod_bvalues[i] == NULL)
  		goto nomem;
  	   lm->mod_bvalues[i+1] = NULL;
--- 151,161 ----
  	lm->mod_bvalues[0]->bv_val = PyString_AsString(list);
      } else if (PySequence_Check(list)) {
  	nstrs = PySequence_Length(list);
! 	lm->mod_bvalues = PyObject_New(struct berval *, nstrs + 1);
  	if (lm->mod_bvalues == NULL)
  		goto nomem;
  	for (i = 0; i < nstrs; i++) {
! 	   lm->mod_bvalues[i] = PyObject_New(struct berval, 1);
  	   if (lm->mod_bvalues[i] == NULL)
  		goto nomem;
  	   lm->mod_bvalues[i+1] = NULL;
***************
*** 194,200 ****
      LDAPMod** lmp;
      for ( lmp = lms; *lmp; lmp++ )
      	LDAPMod_DEL( *lmp );
!     PyMem_DEL(lms);
  }
  
  /* 
--- 194,200 ----
      LDAPMod** lmp;
      for ( lmp = lms; *lmp; lmp++ )
      	LDAPMod_DEL( *lmp );
!     PyObject_Del(lms);
  }
  
  /* 
***************
*** 223,229 ****
         return NULL;
      }
  
!     lms = PyMem_NEW(LDAPMod *, len + 1);
      if (lms == NULL) 
  	goto nomem;
  
--- 223,229 ----
         return NULL;
      }
  
!     lms = PyObject_New(LDAPMod *, len + 1);
      if (lms == NULL) 
  	goto nomem;
  
***************
*** 270,276 ****
  	goto error;
      } else if (PySequence_Check(attrlist)) {
  	len = PySequence_Length(attrlist);
!         attrs = PyMem_NEW(char *, len + 1);
  	if (attrs == NULL)
  	    goto nomem;
  
--- 270,276 ----
  	goto error;
      } else if (PySequence_Check(attrlist)) {
  	len = PySequence_Length(attrlist);
!         attrs = PyObject_New(char *, len + 1);
  	if (attrs == NULL)
  	    goto nomem;
  
***************
*** 312,318 ****
      char **attrs = *attrsp;
  
      if (attrs != NULL) {
!    	PyMem_DEL(attrs);
  	*attrsp = NULL;
      }
  }
--- 312,318 ----
      char **attrs = *attrsp;
  
      if (attrs != NULL) {
!    	PyObject_Del(attrs);
  	*attrsp = NULL;
      }
  }
diff -c /Users/bartolome/Downloads/python-ldap-2.3.5/Modules/ldapcontrol.c /Users/bartolome/Downloads/python-ldap-2.3.5 2/Modules/ldapcontrol.c
*** /Users/bartolome/Downloads/python-ldap-2.3.5/Modules/ldapcontrol.c	2008-03-20 05:24:56.000000000 -0700
--- /Users/bartolome/Downloads/python-ldap-2.3.5 2/Modules/ldapcontrol.c	2008-08-26 20:31:37.000000000 -0700
***************
*** 35,42 ****
          return;
    
      if (lc->ldctl_oid)
!         PyMem_DEL(lc->ldctl_oid);
!     PyMem_DEL(lc);
  }
  
  /* Free an array of LDAPControl objects created by List_to_LDAPControls */
--- 35,42 ----
          return;
    
      if (lc->ldctl_oid)
!         PyObject_Del(lc->ldctl_oid);
!     PyObject_Del(lc);
  }
  
  /* Free an array of LDAPControl objects created by List_to_LDAPControls */
***************
*** 51,57 ****
      for ( lcp = lcs; *lcp; lcp++ )
          LDAPControl_DEL( *lcp );
  
!     PyMem_DEL( lcs );
  }
  
  /* Takes a tuple of the form:
--- 51,57 ----
      for ( lcp = lcs; *lcp; lcp++ )
          LDAPControl_DEL( *lcp );
  
!     PyObject_Del( lcs );
  }
  
  /* Takes a tuple of the form:
***************
*** 80,86 ****
      if (!PyArg_ParseTuple( tup, "sbO", &oid, &iscritical, &bytes ))
          return NULL;
    
!     lc = PyMem_NEW(LDAPControl, 1);
      if (lc == NULL) {
          PyErr_NoMemory();
          return NULL;
--- 80,86 ----
      if (!PyArg_ParseTuple( tup, "sbO", &oid, &iscritical, &bytes ))
          return NULL;
    
!     lc = PyObject_New(LDAPControl, 1);
      if (lc == NULL) {
          PyErr_NoMemory();
          return NULL;
***************
*** 89,95 ****
      lc->ldctl_iscritical = iscritical;
  
      len = strlen(oid);
!     lc->ldctl_oid = PyMem_NEW(char, len + 1);
      if (lc->ldctl_oid == NULL) {
          PyErr_NoMemory();
          LDAPControl_DEL(lc);
--- 89,95 ----
      lc->ldctl_iscritical = iscritical;
  
      len = strlen(oid);
!     lc->ldctl_oid = PyObject_New(char, len + 1);
      if (lc->ldctl_oid == NULL) {
          PyErr_NoMemory();
          LDAPControl_DEL(lc);
***************
*** 136,142 ****
      }
  
      len = PySequence_Length(list);
!     ldcs = PyMem_NEW(LDAPControl*, len + 1);
      if (ldcs == NULL) {
          PyErr_NoMemory();
          return NULL;
--- 136,142 ----
      }
  
      len = PySequence_Length(list);
!     ldcs = PyObject_New(LDAPControl*, len + 1);
      if (ldcs == NULL) {
          PyErr_NoMemory();
          return NULL;
***************
*** 145,157 ****
      for (i = 0; i < len; i++) {
        item = PySequence_GetItem(list, i);
        if (item == NULL) {
!           PyMem_DEL(ldcs);
            return NULL;
        }
  
        ldc = Tuple_to_LDAPControl(item);
        if (ldc == NULL) {
!           PyMem_DEL(ldcs);
            return NULL;
        }
  
--- 145,157 ----
      for (i = 0; i < len; i++) {
        item = PySequence_GetItem(list, i);
        if (item == NULL) {
!           PyObject_Del(ldcs);
            return NULL;
        }
  
        ldc = Tuple_to_LDAPControl(item);
        if (ldc == NULL) {
!           PyObject_Del(ldcs);
            return NULL;
        }
  
