From: Howard Chu Date: Thu, 9 Dec 2004 08:28:12 +0000 (+0000) Subject: A better approach for detach_op X-Git-Tag: OPENLDAP_REL_ENG_2_3_0ALPHA~81 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=4b736945bee4db36b20463baafe518e1c17fc8bd;p=openldap A better approach for detach_op --- diff --git a/servers/slapd/overlays/syncprov.c b/servers/slapd/overlays/syncprov.c index 2465091748..1bd9e61fef 100644 --- a/servers/slapd/overlays/syncprov.c +++ b/servers/slapd/overlays/syncprov.c @@ -1514,10 +1514,16 @@ syncprov_detach_op( Operation *op, syncops *so ) op->o_req_ndn.bv_len + 1 + op->o_ndn.bv_len + 1 + so->s_filterstr.bv_len + 1; - op2 = (Operation *)ch_malloc( size ); - *op2 = *op; + op2 = (Operation *)ch_calloc( 1, size ); op2->o_hdr = (Opheader *)(op2+1); + + /* Copy the fields we care about explicitly, leave the rest alone */ *op2->o_hdr = *op->o_hdr; + op2->o_tag = op->o_tag; + op2->o_time = op->o_time; + op2->o_bd = op->o_bd; + op2->o_request = op->o_request; + if ( i ) { op2->ors_attrs = (AttributeName *)(op2->o_hdr + 1); ptr = (char *)(op2->ors_attrs+i+1); @@ -1541,8 +1547,6 @@ syncprov_detach_op( Operation *op, syncops *so ) strcpy( ptr, so->s_filterstr.bv_val ); op2->ors_filterstr.bv_len = so->s_filterstr.bv_len; op2->ors_filter = str2filter( ptr ); - op2->o_controls = NULL; - op2->o_callback = NULL; so->s_op = op2; /* Copy any cached group ACLs individually */