mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-12-21 15:19:34 -05:00
Plug unlikely memleak (coverity)
This commit is contained in:
parent
7d483f7aba
commit
9e69e0b559
1 changed files with 17 additions and 4 deletions
|
|
@ -194,7 +194,6 @@ rewrite_subst_compile(
|
||||||
subs[ nsub ].bv_len = l;
|
subs[ nsub ].bv_len = l;
|
||||||
subs[ nsub ].bv_val = malloc( l + 1 );
|
subs[ nsub ].bv_val = malloc( l + 1 );
|
||||||
if ( subs[ nsub ].bv_val == NULL ) {
|
if ( subs[ nsub ].bv_val == NULL ) {
|
||||||
free( subs );
|
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
AC_MEMCPY( subs[ nsub ].bv_val, begin, l );
|
AC_MEMCPY( subs[ nsub ].bv_val, begin, l );
|
||||||
|
|
@ -213,8 +212,22 @@ rewrite_subst_compile(
|
||||||
s->lt_subs = subs;
|
s->lt_subs = subs;
|
||||||
s->lt_num_submatch = nsub;
|
s->lt_num_submatch = nsub;
|
||||||
s->lt_submatch = submatch;
|
s->lt_submatch = submatch;
|
||||||
|
subs = NULL;
|
||||||
|
submatch = NULL;
|
||||||
|
|
||||||
cleanup:;
|
cleanup:;
|
||||||
|
if ( subs ) {
|
||||||
|
for ( l=0; l<nsub; l++ ) {
|
||||||
|
free( subs[nsub].bv_val );
|
||||||
|
}
|
||||||
|
free( subs );
|
||||||
|
}
|
||||||
|
if ( submatch ) {
|
||||||
|
for ( l=0; l<nsub; l++ ) {
|
||||||
|
free( submatch[nsub].ls_map );
|
||||||
|
}
|
||||||
|
free( submatch );
|
||||||
|
}
|
||||||
free( result );
|
free( result );
|
||||||
|
|
||||||
return s;
|
return s;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue