[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[Cluster-devel] [PATCH 12/19] config: fix return checks in ldap loader



Spotted by Coverity Scan

Signed-off-by: Fabio M. Di Nitto <fdinitto redhat com>
---
:100644 100644 fb25af4... 49c30b7... M	config/plugins/ldap/configldap.c
 config/plugins/ldap/configldap.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/config/plugins/ldap/configldap.c b/config/plugins/ldap/configldap.c
index fb25af4..49c30b7 100644
--- a/config/plugins/ldap/configldap.c
+++ b/config/plugins/ldap/configldap.c
@@ -216,6 +216,8 @@ static int read_config_for(LDAP *ld, struct objdb_iface_ver0 *objdb, hdb_handle_
 				struct berval **val_ber;
 
 				val_ber = ldap_get_values_len(ld, e, attr);
+				if (!val_ber)
+					goto ldap_next;
 				i=0;
 				while (val_ber[i]) {
 					/*
@@ -244,9 +246,10 @@ static int read_config_for(LDAP *ld, struct objdb_iface_ver0 *objdb, hdb_handle_
 					}
 					i++;
 				}
+				ldap_value_free_len(val_ber);
+ldap_next:
 				ldap_memfree(attr);
 				attr = ldap_next_attribute(ld, e, attr_ber);
-				ldap_value_free_len(val_ber);
 			}
 			ldap_memfree(attr);
 			ber_free(attr_ber, 0);
-- 
1.7.4.4


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]