}
tmpctrls = (LDAPControl *)realloc( unknown_ctrls,
- (unknown_ctrls_num + 2)*sizeof( LDAPControl ) );
+ (unknown_ctrls_num + 1)*sizeof( LDAPControl ) );
if ( tmpctrls == NULL ) {
-
+ fprintf( stderr, "%s: no memory?\n", prog );
+ exit( EXIT_FAILURE );
}
unknown_ctrls = tmpctrls;
ctrl.ldctl_oid = control;
while ( count-- ) {
ctrls[i++] = extra_c++;
}
- count = 0;
- while ( unknown_ctrls_num-- ) {
+ for ( count = 0; count < unknown_ctrls_num; count++ ) {
ctrls[i++] = &unknown_ctrls[count++];
}
ctrls[i] = NULL;