mirror of
https://git.openldap.org/openldap/openldap.git
synced 2024-12-21 03:10:25 +08:00
fix snacc buffer memory leak
This commit is contained in:
parent
ccd3acc98e
commit
c863425358
@ -17,7 +17,7 @@
|
|||||||
|
|
||||||
topbuilddir = ../../../../build
|
topbuilddir = ../../../../build
|
||||||
topsrcdir = ../../..
|
topsrcdir = ../../..
|
||||||
snaccdir = /usr/local/snacc
|
snaccdir = /home/slim/snacc
|
||||||
|
|
||||||
LIBTOOL=$(topbuilddir)/libtool
|
LIBTOOL=$(topbuilddir)/libtool
|
||||||
OPT=-g -O2 -DLDAP_COMPONENT
|
OPT=-g -O2 -DLDAP_COMPONENT
|
||||||
|
@ -201,8 +201,8 @@ comp_convert_attr_to_comp LDAP_P (( Attribute* a, Syntax *syn, struct berval* bv
|
|||||||
int mode, bytesDecoded, size, rc;
|
int mode, bytesDecoded, size, rc;
|
||||||
void* component;
|
void* component;
|
||||||
char* oid = a->a_desc->ad_type->sat_atype.at_oid ;
|
char* oid = a->a_desc->ad_type->sat_atype.at_oid ;
|
||||||
GenBuf* b;
|
GenBuf* b = NULL;
|
||||||
ExpBuf* buf;
|
ExpBuf* buf = NULL;
|
||||||
OidDecoderMapping* odm;
|
OidDecoderMapping* odm;
|
||||||
|
|
||||||
/* look for the decoder registered for the given attribute */
|
/* look for the decoder registered for the given attribute */
|
||||||
@ -233,6 +233,7 @@ comp_convert_attr_to_comp LDAP_P (( Attribute* a, Syntax *syn, struct berval* bv
|
|||||||
}
|
}
|
||||||
|
|
||||||
ExpBufFreeBuf( buf );
|
ExpBufFreeBuf( buf );
|
||||||
|
GenBufFreeBuf( b );
|
||||||
if ( rc == -1 ) {
|
if ( rc == -1 ) {
|
||||||
ShutdownNibbleMemLocal ( a->a_comp_data->cd_mem_op );
|
ShutdownNibbleMemLocal ( a->a_comp_data->cd_mem_op );
|
||||||
free ( a->a_comp_data );
|
free ( a->a_comp_data );
|
||||||
@ -273,6 +274,7 @@ comp_convert_assert_to_comp (
|
|||||||
|
|
||||||
rc = (*decoder)( mem_op, genBuf, csi, len, mode );
|
rc = (*decoder)( mem_op, genBuf, csi, len, mode );
|
||||||
ExpBufFreeBuf ( buf );
|
ExpBufFreeBuf ( buf );
|
||||||
|
GenBufFreeBuf( genBuf );
|
||||||
}
|
}
|
||||||
|
|
||||||
int intToAscii( int value, char* buf ) {
|
int intToAscii( int value, char* buf ) {
|
||||||
@ -662,20 +664,10 @@ comp_test_components( void* attr_nm, void* assert_nm, ComponentSyntaxInfo* csi_a
|
|||||||
mode = DEC_ALLOC_MODE_2;
|
mode = DEC_ALLOC_MODE_2;
|
||||||
|
|
||||||
/* Try to decode with BER/DER decoder */
|
/* Try to decode with BER/DER decoder */
|
||||||
#if 0
|
|
||||||
rc =BDecComponentTop( odm->BER_Decode, attr_nm, b, 0,0, &contained_comp,&bytesDecoded, mode );
|
|
||||||
#endif
|
|
||||||
rc = odm->BER_Decode ( attr_nm, b, (ComponentSyntaxInfo*)&contained_comp, &bytesDecoded, mode );
|
rc = odm->BER_Decode ( attr_nm, b, (ComponentSyntaxInfo*)&contained_comp, &bytesDecoded, mode );
|
||||||
|
|
||||||
#if 0
|
|
||||||
if ( rc != LDAP_SUCCESS ) {
|
|
||||||
/* If fails with BER/DER decoder, try with GSER */
|
|
||||||
bytesDecoded = 0;
|
|
||||||
BufResetInReadMode( b );
|
|
||||||
rc = odm->GSER_decoder( attr_nm, b, contained_comp, &bytesDecoded, mode);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
ExpBufFreeBuf( buf );
|
ExpBufFreeBuf( buf );
|
||||||
|
GenBufFreeBuf( b );
|
||||||
|
|
||||||
if ( rc != LDAP_SUCCESS ) return LDAP_PROTOCOL_ERROR;
|
if ( rc != LDAP_SUCCESS ) return LDAP_PROTOCOL_ERROR;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user