lists.arthurdejong.org
RSS feed

nss-pam-ldapd commit: r1932 - in nss-pam-ldapd-0.8: . nslcd

[Date Prev][Date Next] [Thread Prev][Thread Next]

nss-pam-ldapd commit: r1932 - in nss-pam-ldapd-0.8: . nslcd



Author: arthur
Date: Sat Feb 23 22:11:13 2013
New Revision: 1932
URL: http://arthurdejong.org/viewvc/nss-pam-ldapd?revision=1932&view=revision

Log:
fix a problem in memory handling in myldap_get_values_len() if malloc() would 
fail (r1909 from 0.9)

Modified:
   nss-pam-ldapd-0.8/   (props changed)
   nss-pam-ldapd-0.8/nslcd/myldap.c

Modified: nss-pam-ldapd-0.8/nslcd/myldap.c
==============================================================================
--- nss-pam-ldapd-0.8/nslcd/myldap.c    Fri Feb 22 21:51:06 2013        (r1931)
+++ nss-pam-ldapd-0.8/nslcd/myldap.c    Sat Feb 23 22:11:13 2013        (r1932)
@@ -1572,8 +1572,7 @@
   values=(char **)malloc(sz);
   if (values==NULL)
   {
-    log_log(LOG_CRIT,"myldap_get_values_len(): malloc() failed to allocate 
memory");
-    ldap_value_free_len(bvalues);
+    log_log(LOG_CRIT,"bervalues_to_values(): malloc() failed to allocate 
memory");
     return NULL;
   }
   buf=(char *)values;
@@ -1649,6 +1648,9 @@
     values=bervalues_to_values(bvalues);
     ldap_value_free_len(bvalues);
   }
+  /* check if we got allocated memory */
+  if (values==NULL)
+    return NULL;
   /* store values entry so we can free it later on */
   for (i=0;i<MAX_RANGED_ATTRIBUTES_PER_ENTRY;i++)
     if (entry->rangedattributevalues[i]==NULL)
-- 
To unsubscribe send an email to
nss-pam-ldapd-commits-unsubscribe@lists.arthurdejong.org or see
http://lists.arthurdejong.org/nss-pam-ldapd-commits/