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

Re: (ITS#8014) minor memleak in slapadd



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

Please review attached patch and merge.

Leonid.

---

The attached files is derived from OpenLDAP Software. All of the 
modifications
to OpenLDAP Software represented in the following patch(es) were 
developed by
Peter-Service LLC, Moscow, Russia. Peter-Service LLC has not assigned 
rights
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 
terms.

Peter-Service LLC hereby places the following modifications to OpenLDAP 
Software
(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.

--------------020803010305090509060904
Content-Type: text/x-patch;
 name="its8014.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename="its8014.patch"

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;
 }
 

--------------020803010305090509060904--