diff --git a/servers/slapd/extended.c b/servers/slapd/extended.c
index 7bcee12973d71c6b4835b7a8a482bf987bc78783..6d3237cae4b796b0de47efe423bc699a51dae28a 100644
--- a/servers/slapd/extended.c
+++ b/servers/slapd/extended.c
@@ -183,6 +183,7 @@ do_extended(
 
 	op->o_bd = frontendDB;
 	rs->sr_err = frontendDB->be_extended( op, rs );
+
 done:
 	return rs->sr_err;
 }
diff --git a/servers/slapd/modrdn.c b/servers/slapd/modrdn.c
index f6157df780be6e913f897da7cc14af7062597bcf..44f97d059e9ff8d81f2a59bc1ea0f60c906c8f2d 100644
--- a/servers/slapd/modrdn.c
+++ b/servers/slapd/modrdn.c
@@ -181,7 +181,6 @@ do_modrdn(
 	rs->sr_err = frontendDB->be_modrdn( op, rs );
 
 cleanup:
-
 	slap_graduate_commit_csn( op );
 
 	op->o_tmpfree( op->o_req_dn.bv_val, op->o_tmpmemctx );
@@ -190,8 +189,10 @@ cleanup:
 	op->o_tmpfree( op->orr_newrdn.bv_val, op->o_tmpmemctx );	
 	op->o_tmpfree( op->orr_nnewrdn.bv_val, op->o_tmpmemctx );	
 
-	if ( pnewSuperior.bv_val ) op->o_tmpfree( pnewSuperior.bv_val, op->o_tmpmemctx );
-	if ( nnewSuperior.bv_val ) op->o_tmpfree( nnewSuperior.bv_val, op->o_tmpmemctx );
+	if ( !BER_BVISNULL( &pnewSuperior ) ) 
+		op->o_tmpfree( pnewSuperior.bv_val, op->o_tmpmemctx );
+	if ( !BER_BVISNULL( &nnewSuperior ) )
+		op->o_tmpfree( nnewSuperior.bv_val, op->o_tmpmemctx );
 
 	return rs->sr_err;
 }