fix uninitialized last (NULL) entry in BerVarray

This commit is contained in:
Pierangelo Masarati 2002-01-29 08:58:34 +00:00
parent abf91ca1ff
commit 9b8ffc30ed
2 changed files with 13 additions and 8 deletions

View File

@ -51,7 +51,6 @@ monitor_subsys_backend_init(
Entry *e, *e_backend, *e_tmp;
int i;
struct monitorentrypriv *mp;
struct berval bv[2];
mi = ( struct monitorinfo * )be->be_private;
@ -73,11 +72,11 @@ monitor_subsys_backend_init(
return( -1 );
}
bv[1].bv_val = NULL;
e_tmp = NULL;
for ( i = nBackendInfo; i--; ) {
char buf[1024];
BackendInfo *bi;
char buf[1024];
BackendInfo *bi;
struct berval bv[ 2 ];
bi = &backendInfo[i];
@ -110,6 +109,7 @@ monitor_subsys_backend_init(
bv[0].bv_val = bi->bi_type;
bv[0].bv_len = strlen( bv[0].bv_val );
bv[1].bv_val = NULL;
attr_merge( e, monitor_ad_desc, bv );
attr_merge( e_backend, monitor_ad_desc, bv );

View File

@ -50,7 +50,6 @@ monitor_subsys_database_init(
AttributeDescription *ad_nc = slap_schema.si_ad_namingContexts;
AttributeDescription *ad_seeAlso = NULL;
const char *text = NULL;
struct berval bv[2];
assert( be != NULL );
assert( monitor_ad_desc != NULL );
@ -116,7 +115,10 @@ monitor_subsys_database_init(
}
for ( j = 0; be->be_suffix[j]; j++ ) {
bv[0] = *be->be_suffix[j];
struct berval bv[ 2 ];
bv[ 0 ] = *be->be_suffix[ j ];
bv[ 1 ].bv_val = NULL;
attr_merge( e, ad_nc, bv );
attr_merge( e_database, ad_nc, bv );
@ -124,6 +126,8 @@ monitor_subsys_database_init(
for ( j = nBackendInfo; j--; ) {
if ( &backendInfo[ j ] == be->bd_info ) {
struct berval bv[ 2 ];
/* we check the pointer; the test on the
* string should be more reliable */
assert( strcasecmp( backendInfo[ j ].bi_type,
@ -132,8 +136,9 @@ monitor_subsys_database_init(
snprintf( buf, sizeof( buf ),
"cn=Backend %d,%s",
j, monitor_subsys[SLAPD_MONITOR_BACKEND].mss_dn.bv_val );
bv->bv_val = buf;
bv->bv_len = strlen( buf );
bv[ 0 ].bv_val = buf;
bv[ 0 ].bv_len = strlen( buf );
bv[ 1 ].bv_val = NULL;
attr_merge( e, ad_seeAlso, bv );
break;
}