mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-12-18 21:26:29 -05:00
ITS#10328 librewrite: fix substitution cleanup
This commit is contained in:
parent
ca5391b811
commit
e5a545d54c
1 changed files with 6 additions and 6 deletions
|
|
@ -131,6 +131,7 @@ rewrite_subst_compile(
|
|||
map = rewrite_xmap_parse( info,
|
||||
p + 3, (const char **)&begin );
|
||||
if ( map == NULL ) {
|
||||
nsub++; /* make sure subs[nsub] is freed */
|
||||
goto cleanup;
|
||||
}
|
||||
submatch[ nsub ].ls_map = map;
|
||||
|
|
@ -146,6 +147,7 @@ rewrite_subst_compile(
|
|||
map = rewrite_map_parse( info, p + 2,
|
||||
(const char **)&begin );
|
||||
if ( map == NULL ) {
|
||||
nsub++; /* make sure subs[nsub] is freed */
|
||||
goto cleanup;
|
||||
}
|
||||
p = begin - 1;
|
||||
|
|
@ -165,6 +167,7 @@ rewrite_subst_compile(
|
|||
continue;
|
||||
|
||||
} else {
|
||||
nsub++; /* make sure subs[nsub] is freed */
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
|
|
@ -176,10 +179,6 @@ rewrite_subst_compile(
|
|||
*/
|
||||
tmps = (struct berval * )realloc( subs, sizeof( struct berval )*( nsub + 1 ) );
|
||||
if ( tmps == NULL ) {
|
||||
/*
|
||||
* XXX need to free the value subst stuff!
|
||||
*/
|
||||
free( subs );
|
||||
goto cleanup;
|
||||
}
|
||||
subs = tmps;
|
||||
|
|
@ -200,6 +199,7 @@ rewrite_subst_compile(
|
|||
|
||||
s = calloc( sizeof( struct rewrite_subst ), 1 );
|
||||
if ( s == NULL ) {
|
||||
nsub++; /* make sure last elements are freed */
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
|
|
@ -213,13 +213,13 @@ rewrite_subst_compile(
|
|||
cleanup:;
|
||||
if ( subs ) {
|
||||
for ( l=0; l<nsub; l++ ) {
|
||||
free( subs[nsub].bv_val );
|
||||
free( subs[l].bv_val );
|
||||
}
|
||||
free( subs );
|
||||
}
|
||||
if ( submatch ) {
|
||||
for ( l=0; l<nsub; l++ ) {
|
||||
free( submatch[nsub].ls_map );
|
||||
free( submatch[l].ls_map );
|
||||
}
|
||||
free( submatch );
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue