]> git.sur5r.net Git - openldap/blobdiff - libraries/libldap/controls.c
Add O_EXCL
[openldap] / libraries / libldap / controls.c
index 12f455be9863cc1e9fc97ef205d6a2b14abc3bd5..f3af141e1ea29c73ce025ceb104139fb37d23a78 100644 (file)
@@ -285,7 +285,7 @@ ldap_controls_dup( LDAPControl *const *controls )
                return NULL;
        }
 
-       new = (LDAPControl **) LDAP_MALLOC( i * sizeof(LDAPControl *) );
+       new = (LDAPControl **) LDAP_MALLOC( (i+1) * sizeof(LDAPControl *) );
 
        if( new == NULL ) {
                /* memory allocation failure */