From 8fdfe1fcd036314fdcded517729f6cf873ead5e2 Mon Sep 17 00:00:00 2001 From: Pierangelo Masarati Date: Sun, 7 Aug 2005 16:45:13 +0000 Subject: [PATCH] plug yet another one-time leak --- servers/slapd/back-meta/config.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/servers/slapd/back-meta/config.c b/servers/slapd/back-meta/config.c index 87f0a90fdf..24f357ed5e 100644 --- a/servers/slapd/back-meta/config.c +++ b/servers/slapd/back-meta/config.c @@ -610,7 +610,7 @@ meta_back_db_config( /* dn massaging */ } else if ( strcasecmp( argv[ 0 ], "suffixmassage" ) == 0 ) { BackendDB *tmp_be; - int i = mi->mi_ntargets - 1; + int i = mi->mi_ntargets - 1, rc; struct berval dn, nvnc, pvnc, nrnc, prnc; if ( i < 0 ) { @@ -638,8 +638,7 @@ meta_back_db_config( return 1; } - dn.bv_val = argv[ 1 ]; - dn.bv_len = strlen( argv[ 1 ] ); + ber_str2bv( argv[ 1 ], 0, 0, &dn ); if ( dnPrettyNormal( NULL, &dn, &pvnc, &nvnc, NULL ) != LDAP_SUCCESS ) { fprintf( stderr, "%s: line %d: " "suffix '%s' is invalid\n", @@ -658,8 +657,7 @@ meta_back_db_config( return 1; } - dn.bv_val = argv[ 2 ]; - dn.bv_len = strlen( argv[ 2 ] ); + ber_str2bv( argv[ 2 ], 0, 0, &dn ); if ( dnPrettyNormal( NULL, &dn, &prnc, &nrnc, NULL ) != LDAP_SUCCESS ) { fprintf( stderr, "%s: line %d: " "massaged suffix '%s' is invalid\n", @@ -690,8 +688,15 @@ meta_back_db_config( * FIXME: no extra rewrite capabilities should be added * to the database */ - return suffix_massage_config( mi->mi_targets[ i ].mt_rwmap.rwm_rw, + rc = suffix_massage_config( mi->mi_targets[ i ].mt_rwmap.rwm_rw, &pvnc, &nvnc, &prnc, &nrnc ); + + free( pvnc.bv_val ); + free( nvnc.bv_val ); + free( prnc.bv_val ); + free( nrnc.bv_val ); + + return rc; /* rewrite stuff ... */ } else if ( strncasecmp( argv[ 0 ], "rewrite", 7 ) == 0 ) { -- 2.39.5