Slight memfree cleanup

This commit is contained in:
Kurt Zeilenga 2001-12-04 06:10:10 +00:00
parent bf4bbcaae2
commit 4041ef05bf

View File

@ -596,7 +596,8 @@ ber_scanf ( BerElement *ber,
(j + 2) * sizeof(char *) ); (j + 2) * sizeof(char *) );
if( *sss == NULL ) { if( *sss == NULL ) {
LBER_FREE( save ); save[j] = NULL;
ber_memvfree( save );
rc = LBER_DEFAULT; rc = LBER_DEFAULT;
goto breakout; goto breakout;
} }
@ -604,8 +605,7 @@ ber_scanf ( BerElement *ber,
rc = ber_get_stringa( ber, &((*sss)[j]) ); rc = ber_get_stringa( ber, &((*sss)[j]) );
j++; j++;
} }
if ( j > 0 ) if ( j > 0 ) (*sss)[j] = NULL;
(*sss)[j] = NULL;
break; break;
case 'V': /* sequence of strings + lengths */ case 'V': /* sequence of strings + lengths */
@ -622,7 +622,8 @@ ber_scanf ( BerElement *ber,
(j + 2) * sizeof(struct berval *) ); (j + 2) * sizeof(struct berval *) );
if( *bv == NULL ) { if( *bv == NULL ) {
LBER_FREE( save ); save[j] = NULL;
ber_bvecfree( save );
rc = LBER_DEFAULT; rc = LBER_DEFAULT;
goto breakout; goto breakout;
} }
@ -630,8 +631,7 @@ ber_scanf ( BerElement *ber,
rc = ber_get_stringal( ber, &((*bv)[j]) ); rc = ber_get_stringal( ber, &((*bv)[j]) );
j++; j++;
} }
if ( j > 0 ) if ( j > 0 ) (*bv)[j] = NULL;
(*bv)[j] = NULL;
break; break;
case 'x': /* skip the next element - whatever it is */ case 'x': /* skip the next element - whatever it is */
@ -744,11 +744,7 @@ breakout:
case 'v': /* sequence of strings */ case 'v': /* sequence of strings */
sss = va_arg( ap, char *** ); sss = va_arg( ap, char *** );
if ( *sss ) { if ( *sss ) {
for (j = 0; (*sss)[j]; j++) { ber_memvfree( *sss );
LBER_FREE( (*sss)[j] );
(*sss)[j] = NULL;
}
LBER_FREE( *sss );
*sss = NULL; *sss = NULL;
} }
break; break;