File 0015-Fix-double-free-of-search-base-with-page-size-0.patch of Package openldap2.5013

From e0e65f309dc0eb5582387acf1b2c2b5b3955f6b6 Mon Sep 17 00:00:00 2001
From: Ryan Tandy <ryan@nardis.ca>
Date: Wed, 17 May 2017 20:07:39 -0700
Subject: [PATCH] Fix double free of search base with page size 0

diff -rupN openldap-2.4.41/servers/slapd/back-mdb/search.c openldap-2.4.41-patched/servers/slapd/back-mdb/search.c
--- openldap-2.4.41/servers/slapd/back-mdb/search.c	2017-05-31 11:15:59.570066763 +0200
+++ openldap-2.4.41-patched/servers/slapd/back-mdb/search.c	2017-05-31 11:17:27.330588732 +0200
@@ -1066,7 +1066,8 @@ notfound:
 			/* check size limit */
 			if ( get_pagedresults(op) > SLAP_CONTROL_IGNORED ) {
 				if ( rs->sr_nentries >= ((PagedResultsState *)op->o_pagedresults_state)->ps_size ) {
-					mdb_entry_return( op, e );
+                    if (e != base)
+					    mdb_entry_return( op, e );
 					e = NULL;
 					send_paged_response( op, rs, &lastid, tentries );
 					goto done;