]> git.sur5r.net Git - openldap/commitdiff
ITS#8782 plug memleaks in cancel
authorHoward Chu <hyc@openldap.org>
Mon, 4 Dec 2017 15:59:33 +0000 (15:59 +0000)
committerHoward Chu <hyc@openldap.org>
Mon, 4 Dec 2017 16:00:33 +0000 (16:00 +0000)
libraries/libldap/cancel.c

index b09f6f021e0ba08c77ab8203a122a43ff8cc276c..f3677b13a4be52ffbb23718088895f484830b19f 100644 (file)
@@ -42,14 +42,14 @@ ldap_cancel(
        int             *msgidp )
 {
        BerElement *cancelidber = NULL;
-       struct berval *cancelidvalp = NULL;
+       struct berval cancelidvalp = { 0, NULL };
        int rc;
 
        cancelidber = ber_alloc_t( LBER_USE_DER );
        ber_printf( cancelidber, "{i}", cancelid );
-       ber_flatten( cancelidber, &cancelidvalp );
+       ber_flatten2( cancelidber, &cancelidvalp, 0 );
        rc = ldap_extended_operation( ld, LDAP_EXOP_CANCEL,
-               cancelidvalp, sctrls, cctrls, msgidp );
+               &cancelidvalp, sctrls, cctrls, msgidp );
        ber_free( cancelidber, 1 );
        return rc;
 }
@@ -62,14 +62,14 @@ ldap_cancel_s(
        LDAPControl     **cctrls )
 {
        BerElement *cancelidber = NULL;
-       struct berval *cancelidvalp = NULL;
+       struct berval cancelidvalp = { 0, NULL };
        int rc;
 
        cancelidber = ber_alloc_t( LBER_USE_DER );
        ber_printf( cancelidber, "{i}", cancelid );
-       ber_flatten( cancelidber, &cancelidvalp );
+       ber_flatten2( cancelidber, &cancelidvalp, 0 );
        rc = ldap_extended_operation_s( ld, LDAP_EXOP_CANCEL,
-               cancelidvalp, sctrls, cctrls, NULL, NULL );
+               &cancelidvalp, sctrls, cctrls, NULL, NULL );
        ber_free( cancelidber, 1 );
        return rc;
 }