{
if( val.bv_len == 0 || atoi(val.bv_val) != 1 ) {
fprintf( stderr, "%s: invalid version %s, line %d (ignored)\n",
- prog, val.bv_val == NULL ? "(null)" : val.bv_val, linenum );
+ prog, val.bv_val, linenum );
}
version++;
} else if ( strcasecmp( type, T_DN_STR ) == 0 ) {
- if (( dn = ber_strdup( val.bv_val ? val.bv_val : "" )) == NULL ) {
+ if (( dn = ber_strdup( val.bv_val )) == NULL ) {
perror( "strdup" );
exit( EXIT_FAILURE );
}
if ( expect_newrdn ) {
if ( strcasecmp( type, T_NEWRDNSTR ) == 0 ) {
- if (( newrdn = ber_strdup( val.bv_val ? val.bv_val : "" )) == NULL ) {
+ if (( newrdn = ber_strdup( val.bv_val )) == NULL ) {
perror( "strdup" );
exit( EXIT_FAILURE );
}
}
} else if ( expect_newsup ) {
if ( strcasecmp( type, T_NEWSUPSTR ) == 0 ) {
- if (( newsup = ber_strdup( val.bv_val ? val.bv_val : "" )) == NULL ) {
+ if (( newsup = ber_strdup( val.bv_val )) == NULL ) {
perror( "strdup" );
exit( EXIT_FAILURE );
}
prog, linenum, dn );
rc = LDAP_PARAM_ERROR;
} else {
- addmodifyop( &pmods, modop, type, val.bv_val == NULL ? NULL : &val );
+ addmodifyop( &pmods, modop, type, &val );
}
end_line:
/* no value is present, error out */
ber_pvt_log_printf( LDAP_DEBUG_PARSE, ldif_debug,
"ldif_parse_line: %s missing base64 value\n", type );
- value = NULL;
- vlen = 0;
- goto done;
+ ber_memfree( freeme );
+ return( -1 );
}
byte = value = s;
/* no value is present, error out */
ber_pvt_log_printf( LDAP_DEBUG_PARSE, ldif_debug,
"ldif_parse_line: %s missing URL value\n", type );
- value = NULL;
- vlen = 0;
- goto done;
+ ber_memfree( freeme );
+ return( -1 );
}
if( ldif_fetch_url( s, &value, &vlen ) ) {
vlen = (int) (d - s);
}
-done:
type = ber_strdup( type );
if( type == NULL ) {
return( -1 );
}
- if( !url && value != NULL ) {
+ if( !url ) {
p = ber_memalloc( vlen + 1 );
if( p == NULL ) {
ber_pvt_log_printf( LDAP_DEBUG_ANY, ldif_debug,
#ifdef NEW_LOGGING
LDAP_LOG( OPERATION, DETAIL1, "str2entry: "
"entry %ld has multiple DNs \"%s\" and \"%s\"\n",
- (long) e->e_id, e->e_dn,
- vals[0].bv_val != NULL ? vals[0].bv_val : "" );
+ (long) e->e_id, e->e_dn, vals[0].bv_val );
#else
Debug( LDAP_DEBUG_ANY, "str2entry: "
"entry %ld has multiple DNs \"%s\" and \"%s\"\n",
- (long) e->e_id, e->e_dn,
- vals[0].bv_val != NULL ? vals[0].bv_val : "" );
+ (long) e->e_id, e->e_dn, vals[0].bv_val );
#endif
- if( vals[0].bv_val != NULL ) free( vals[0].bv_val );
+ free( vals[0].bv_val );
entry_free( e );
return NULL;
}
type, 0, 0 );
#endif
free( type );
- if ( value != NULL )
- free( value );
+ free( value );
return -1;
}
}
free( type );
- if ( value != NULL )
- free( value );
+ free( value );
}
if ( state != GOT_ALL ) {
free( type );
if ( !repl_ok ) {
warn_unknown_replica( value, port );
- if ( value != NULL )
- free( value );
+ free( value );
continue;
}
rh[ nreplicas ].rh_port = port;
nreplicas++;
- if ( value != NULL )
- free( value );
+ free( value );
}
if ( nreplicas == 0 ) {