From 5584e5b98d45c52d5958b3348061bf6fb2988668 Mon Sep 17 00:00:00 2001
From: Howard Chu <hyc@openldap.org>
Date: Fri, 3 Feb 2012 09:35:13 -0800
Subject: [PATCH] ITS#7150 fix check for already abandoned op

---
 servers/slapd/overlays/syncprov.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/servers/slapd/overlays/syncprov.c b/servers/slapd/overlays/syncprov.c
index a9c30ae8dc..8c6c296feb 100644
--- a/servers/slapd/overlays/syncprov.c
+++ b/servers/slapd/overlays/syncprov.c
@@ -2115,10 +2115,12 @@ syncprov_op_mod( Operation *op, SlapReply *rs )
 				/* clean up if the caller is giving up */
 				if ( op->o_abandon ) {
 					modinst *m2;
-					for ( m2 = mt->mt_mods; m2->mi_next != mi;
+					for ( m2 = mt->mt_mods; m2 && m2->mi_next != mi;
 						m2 = m2->mi_next );
-					m2->mi_next = mi->mi_next;
-					if ( mt->mt_tail == mi ) mt->mt_tail = m2;
+					if ( m2 ) {
+						m2->mi_next = mi->mi_next;
+						if ( mt->mt_tail == mi ) mt->mt_tail = m2;
+					}
 					op->o_tmpfree( cb, op->o_tmpmemctx );
 					ldap_pvt_thread_mutex_unlock( &mt->mt_mutex );
 					return SLAPD_ABANDON;
-- 
GitLab