fix one-time leak (coverity)

This commit is contained in:
Pierangelo Masarati 2007-09-03 16:27:01 +00:00
parent 55e908dca2
commit 9beb9f9f51

View File

@ -1441,14 +1441,12 @@ memberof_db_init(
ConfigReply *cr )
{
slap_overinst *on = (slap_overinst *)be->bd_info;
memberof_t *mo;
memberof_t tmp_mo = { 0 }, *mo;
int rc;
const char *text = NULL;
mo = (memberof_t *)ch_calloc( 1, sizeof( memberof_t ) );
rc = slap_str2ad( SLAPD_MEMBEROF_ATTR, &mo->mo_ad_memberof, &text );
rc = slap_str2ad( SLAPD_MEMBEROF_ATTR, &tmp_mo.mo_ad_memberof, &text );
if ( rc != LDAP_SUCCESS ) {
Debug( LDAP_DEBUG_ANY,
"memberof_db_init: "
@ -1457,7 +1455,7 @@ memberof_db_init(
return rc;
}
rc = slap_str2ad( SLAPD_GROUP_ATTR, &mo->mo_ad_member, &text );
rc = slap_str2ad( SLAPD_GROUP_ATTR, &tmp_mo.mo_ad_member, &text );
if ( rc != LDAP_SUCCESS ) {
Debug( LDAP_DEBUG_ANY,
"memberof_db_init: "
@ -1466,8 +1464,8 @@ memberof_db_init(
return rc;
}
mo->mo_oc_group = oc_find( SLAPD_GROUP_CLASS );
if ( mo->mo_oc_group == NULL ) {
tmp_mo.mo_oc_group = oc_find( SLAPD_GROUP_CLASS );
if ( tmp_mo.mo_oc_group == NULL ) {
Debug( LDAP_DEBUG_ANY,
"memberof_db_init: "
"unable to find objectClass=\"%s\"\n",
@ -1475,6 +1473,9 @@ memberof_db_init(
return 1;
}
mo = (memberof_t *)ch_calloc( 1, sizeof( memberof_t ) );
*mo = tmp_mo;
on->on_bi.bi_private = (void *)mo;
return 0;