- if( (ber_int_options.lbo_valid == LBER_UNINITIALIZED)
- && ( ber_int_memory_fns == NULL )
- && ( option == LBER_OPT_MEMORY_FNS )
- && ( invalue != NULL ))
- {
- const BerMemoryFunctions *f =
- (const BerMemoryFunctions *) invalue;
-
- /* make sure all functions are provided */
- if(!( f->bmf_malloc && f->bmf_calloc
- && f->bmf_realloc && f->bmf_free ))
- {
- ber_errno = LBER_ERROR_PARAM;
- return LBER_OPT_ERROR;
- }
-
- ber_int_memory_fns = (BerMemoryFunctions *)
- (*(f->bmf_malloc))(sizeof(BerMemoryFunctions));
-
- if ( ber_int_memory_fns == NULL ) {
- ber_errno = LBER_ERROR_MEMORY;
- return LBER_OPT_ERROR;
- }
-
- AC_MEMCPY(ber_int_memory_fns, f, sizeof(BerMemoryFunctions));
-
- ber_int_options.lbo_valid = LBER_INITIALIZED;
- return LBER_OPT_SUCCESS;
- }
-
- ber_int_options.lbo_valid = LBER_INITIALIZED;
-