[Fedora-directory-commits] ldapserver/ldap/servers/plugins/replication repl5_replica.c, 1.21, 1.22

Richard Allen Megginson rmeggins at fedoraproject.org
Thu Feb 19 21:28:04 UTC 2009


Author: rmeggins

Update of /cvs/dirsec/ldapserver/ldap/servers/plugins/replication
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv16590/ldapserver/ldap/servers/plugins/replication

Modified Files:
	repl5_replica.c 
Log Message:
Resolves: bug 486191
Bug Description: slapd hang during cs80 cloning setup.
Reviewed by: nhosoi (Thanks!)
Fix Description: If replication code attempts to add the RUV entry during replica configuration, and the add operation returns an error, the code will attempt to free the entry.  This causes a double free.  Internal add operations always consume and free the entry, success or failure.  The solution is to set the entry to NULL just after adding it so the clean up code will not be able to free it again.
Platforms tested: RHEL5
Flag Day: no
Doc impact: no



Index: repl5_replica.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/plugins/replication/repl5_replica.c,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -r1.21 -r1.22
--- repl5_replica.c	5 Dec 2008 22:41:52 -0000	1.21
+++ repl5_replica.c	19 Feb 2009 21:28:01 -0000	1.22
@@ -2654,7 +2654,7 @@
 {
 	int return_value = LDAP_LOCAL_ERROR;
 	char *root_entry_str;
-	Slapi_Entry *e;
+	Slapi_Entry *e = NULL;
     const char *purl = NULL;
     RUV *ruv;
     struct berval **bvals = NULL;
@@ -2744,15 +2744,13 @@
 		OP_FLAG_TOMBSTONE_ENTRY | OP_FLAG_REPLICATED | OP_FLAG_REPL_FIXUP |
 		OP_FLAG_REPL_RUV);
 	slapi_add_internal_pb(pb);
+	e = NULL; /* add consumes e, upon success or failure */
 	slapi_pblock_get(pb, SLAPI_PLUGIN_INTOP_RESULT, &return_value);
     if (return_value == LDAP_SUCCESS)
         r->repl_ruv_dirty = PR_FALSE;
 		
 done:
-    if (return_value != LDAP_SUCCESS)
-    {
-        slapi_entry_free (e);
-    }
+    slapi_entry_free (e);
 
     if (bvals)
         ber_bvecfree(bvals);




More information about the Fedora-directory-commits mailing list