lists.arthurdejong.org
RSS feed

nss-pam-ldapd commit: r1909 - nss-pam-ldapd/nslcd

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

nss-pam-ldapd commit: r1909 - nss-pam-ldapd/nslcd



Author: arthur
Date: Sat Jan 12 23:24:06 2013
New Revision: 1909
URL: http://arthurdejong.org/viewvc/nss-pam-ldapd?revision=1909&view=revision

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

Modified:
   nss-pam-ldapd/nslcd/myldap.c

Modified: nss-pam-ldapd/nslcd/myldap.c
==============================================================================
--- nss-pam-ldapd/nslcd/myldap.c        Sat Jan 12 23:23:02 2013        (r1908)
+++ nss-pam-ldapd/nslcd/myldap.c        Sat Jan 12 23:24:06 2013        (r1909)
@@ -1586,8 +1586,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;
@@ -1663,6 +1662,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/