diff --git a/servers/slapd/back-monitor/database.c b/servers/slapd/back-monitor/database.c index 6672c611cf..2d532c77e2 100644 --- a/servers/slapd/back-monitor/database.c +++ b/servers/slapd/back-monitor/database.c @@ -361,29 +361,8 @@ monitor_subsys_database_init( li->li_bvuri, NULL ); #else char **urls = ldap_str2charray( li->li_uri, " " ); - int u; - for ( u = 0; urls[ u ] != NULL; u++ ) { - struct berval bv; - - ber_str2bv( urls[ u ], 0, 0, &bv ); - - attr_merge_normalize_one( e, - slap_schema.si_ad_labeledURI, - &bv, NULL ); - } - - ldap_charray_free( urls ); -#endif - -#endif /* defined(SLAPD_LDAP) */ -#if defined(SLAPD_META) - } else if ( strcmp( bi->bi_type, "meta" ) == 0 ) { - metainfo_t *mi = (metainfo_t *)be->be_private; - int t; - - for ( t = 0; t < mi->mi_ntargets; t++ ) { - char **urls = ldap_str2charray( mi->mi_targets[ t ].mt_uri, " " ); + if ( urls != NULL ) { int u; for ( u = 0; urls[ u ] != NULL; u++ ) { @@ -395,8 +374,35 @@ monitor_subsys_database_init( slap_schema.si_ad_labeledURI, &bv, NULL ); } + ldap_charray_free( urls ); } +#endif + +#endif /* defined(SLAPD_LDAP) */ +#if defined(SLAPD_META) + } else if ( strcmp( bi->bi_type, "meta" ) == 0 ) { + metainfo_t *mi = (metainfo_t *)be->be_private; + int t; + + for ( t = 0; t < mi->mi_ntargets; t++ ) { + char **urls = ldap_str2charray( mi->mi_targets[ t ].mt_uri, " " ); + + if ( urls != NULL ) { + int u; + + for ( u = 0; urls[ u ] != NULL; u++ ) { + struct berval bv; + + ber_str2bv( urls[ u ], 0, 0, &bv ); + + attr_merge_normalize_one( e, + slap_schema.si_ad_labeledURI, + &bv, NULL ); + } + ldap_charray_free( urls ); + } + } #endif /* defined(SLAPD_META) */ }