[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: (ITS#8014) minor memleak in slapadd

This is a multi-part message in MIME format.
Content-Type: text/plain; charset=windows-1251; format=flowed
Content-Transfer-Encoding: 7bit

Please review attached patch and merge.



The attached files is derived from OpenLDAP Software. All of the 
to OpenLDAP Software represented in the following patch(es) were 
developed by
Peter-Service LLC, Moscow, Russia. Peter-Service LLC has not assigned 
and/or interest in this work to any party. I, Leonid Yuriev am 
authorized by
Peter-Service LLC, my employer, to release this work under the following 

Peter-Service LLC hereby places the following modifications to OpenLDAP 
(and only these modifications) into the public domain. Hence, these
modifications may be freely used and/or redistributed for any purpose
with or without attribution and/or other notice.

Content-Type: text/x-patch;
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;

commit 39ffdbe0abda49189d52432a4c950589a288a9c0
Author: Leo Yuriev <leo@yuriev.ru>
Date:   2015-01-01 23:52:14 +0300

    ITS#8014: minor CSN memleak in slapadd.

diff --git a/servers/slapd/slapcommon.c b/servers/slapd/slapcommon.c
index 01a4955..73c6579 100644
--- a/servers/slapd/slapcommon.c
+++ b/servers/slapd/slapcommon.c
@@ -975,7 +975,7 @@ slap_tool_update_ctxcsn(
 	struct berval ctxdn;
 	ID ctxcsn_id;
-	Entry *ctxcsn_e;
+	Entry *ctxcsn_e = NULL;
 	int rc = EXIT_SUCCESS;
 	if ( !(update_ctxcsn && !dryrun && sid != SLAP_SYNC_SID_MAX + 1) ) {
@@ -1093,6 +1093,11 @@ slap_tool_update_ctxcsn(
+	if (ctxcsn_e) {
+		Operation op = {0};
+		op.o_bd = be;
+		be_entry_release_w(&op, ctxcsn_e);
+	}
 	return rc;