]> git.sur5r.net Git - openldap/commitdiff
ITS#6376 plug potential leak
authorHoward Chu <hyc@openldap.org>
Sat, 14 Nov 2009 09:34:29 +0000 (09:34 +0000)
committerHoward Chu <hyc@openldap.org>
Sat, 14 Nov 2009 09:34:29 +0000 (09:34 +0000)
servers/slapd/overlays/syncprov.c

index 354867ee6531a9a9021d5c96a07d4f7bc51b7cca..a722bae7aa952f10651d5b7744e1f9ee225ffac0 100644 (file)
@@ -855,7 +855,15 @@ syncprov_sendresp( Operation *op, opcookie *opc, syncops *so,
        }
        /* In case someone else freed it already? */
        if ( rs.sr_ctrls ) {
-               op->o_tmpfree( rs.sr_ctrls[0], op->o_tmpmemctx );
+               int i;
+               for ( i=0; rs.sr_ctrls[i]; i++ ) {
+                       if ( rs.sr_ctrls[i] == ctrls[0] ) {
+                               op->o_tmpfree( ctrls[0]->ldctl_value.bv_val, op->o_tmpmemctx );
+                               ctrls[0]->ldctl_value.bv_val = NULL;
+                               break;
+                       }
+               }
+               slap_free_ctrls( op, rs.sr_ctrls );
                rs.sr_ctrls = NULL;
        }