]> git.sur5r.net Git - openldap/blobdiff - libraries/libldap/cancel.c
ITS#8782 plug memleaks in cancel
[openldap] / libraries / libldap / cancel.c
index 83954afdab442c7429108302a9a3fab9c8bdb384..f3677b13a4be52ffbb23718088895f484830b19f 100644 (file)
@@ -1,7 +1,7 @@
 /* $OpenLDAP$ */
 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
  *
- * Copyright 1998-2013 The OpenLDAP Foundation.
+ * Copyright 1998-2017 The OpenLDAP Foundation.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -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;
 }