[Fedora-directory-commits] ldapserver/ldap/servers/plugins/replication repl5_protocol_util.c, 1.10, 1.11

Noriko Hosoi (nhosoi) fedora-directory-commits at redhat.com
Wed Oct 3 00:55:37 UTC 2007


Author: nhosoi

Update of /cvs/dirsec/ldapserver/ldap/servers/plugins/replication
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv32219/plugins/replication

Modified Files:
	repl5_protocol_util.c 
Log Message:
Resolves: #196523
Summary: miscellaneous memory leaks
Description: 1) fixed memory leaks
2) cleaned up normalize_path code with fixing memory leaks



Index: repl5_protocol_util.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/plugins/replication/repl5_protocol_util.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- repl5_protocol_util.c	21 Nov 2006 19:14:10 -0000	1.10
+++ repl5_protocol_util.c	3 Oct 2007 00:55:34 -0000	1.11
@@ -117,6 +117,10 @@
 	int return_value;
 	ConnResult crc;
 	Repl_Connection *conn;
+	struct berval *retdata = NULL;
+	char *retoid = NULL;
+	Slapi_DN *replarea_sdn = NULL;
+	struct berval **ruv_bervals = NULL;
 
 	PR_ASSERT(prp && prot_oid);
 
@@ -200,9 +204,6 @@
 			} else 
 			{
 				CSN *current_csn = NULL;
-				struct berval *retdata = NULL;
-				char *retoid = NULL;
-				Slapi_DN *replarea_sdn;
 
 				/* Good to go. Start the protocol. */
 
@@ -243,7 +244,6 @@
 						 * Extop was processed. Look at extop response to see if we're
 						 * permitted to go ahead.
 						 */
-						struct berval **ruv_bervals = NULL;
 						int extop_result;
 						int extop_rc = decode_repl_ext_response(retdata, &extop_result,
 																&ruv_bervals);
@@ -411,8 +411,6 @@
 							prp->last_acquire_response_code = NSDS50_REPL_INTERNAL_ERROR;
 							return_value = ACQUIRE_FATAL_ERROR;
 						}
-						if (NULL != ruv_bervals)
-							ber_bvecfree(ruv_bervals);
 					}
 					else
 					{
@@ -437,15 +435,18 @@
 						agmt_get_long_name(prp->agmt));
 					return_value = ACQUIRE_FATAL_ERROR;
 				}
-				slapi_sdn_free(&replarea_sdn);
-				if (NULL != retoid)
-					ldap_memfree(retoid);
-				if (NULL != retdata)
-					ber_bvfree(retdata);
 			}
 		}
 	}
 error:
+	if (NULL != ruv_bervals)
+		ber_bvecfree(ruv_bervals);
+	if (NULL != replarea_sdn)
+		slapi_sdn_free(&replarea_sdn);
+	if (NULL != retoid)
+		ldap_memfree(retoid);
+	if (NULL != retdata)
+		ber_bvfree(retdata);
 
 	if (ACQUIRE_SUCCESS != return_value)
 	{




More information about the Fedora-directory-commits mailing list