example.c
#define MAX_PORTS 64
#define MAX_IDS ( MAX_PORTS * 256)
#define MAX_MSG_LEN 4096
static char ** g_aaa_eap_str_buff;
void thread_authenticator ( void * _arg )
{
g_aaa_eap_str_buff = ( char ** ) malloc ( MAX_IDS);
if ( 0 == g_aaa_eap_str_buff) {
log_error ( "Failed to allocate buffer for storing eap strings" );
return;
}
for ( int i = 0; i < MAX_IDS; i ++ ) {
g_aaa_eap_str_buff [ i ] = ( char * ) malloc ( MAX_MSG_LEN );
if ( 0 == g_aaa_eap_str_buff [ i ]) {
log_error ( "Failed to allocate buffer for storing eap strings" );
}
}
while ( 1 ) {
...
}
}
#define MAX_PORTS 64
#define MAX_IDS ( MAX_PORTS * 256)
#define MAX_MSG_LEN 4096
static char ** g_aaa_eap_str_buff;
void thread_authenticator ( void * _arg )
{
g_aaa_eap_str_buff = ( char ** ) malloc ( MAX_IDS);
if ( 0 == g_aaa_eap_str_buff) {
log_error ( "Failed to allocate buffer for storing eap strings" );
return;
}
for ( int i = 0; i < MAX_IDS; i ++ ) {
g_aaa_eap_str_buff [ i ] = ( char * ) malloc ( MAX_MSG_LEN );
if ( 0 == g_aaa_eap_str_buff [ i ]) {
log_error ( "Failed to allocate buffer for storing eap strings" );
}
}
while ( 1 ) {
...
}
}
图1
example.c
#define MAX_PORTS 64
#define MAX_IDS ( MAX_PORTS * 256)
#define MAX_MSG_LEN 4096
static char ** g_aaa_eap_str_buff [ MAX_IDS ][ MAX_MSG_LEN ];
void thread_authenticator ( void * _arg )
{
while ( 1 ) {
...
}
}
#define MAX_PORTS 64
#define MAX_IDS ( MAX_PORTS * 256)
#define MAX_MSG_LEN 4096
static char ** g_aaa_eap_str_buff [ MAX_IDS ][ MAX_MSG_LEN ];
void thread_authenticator ( void * _arg )
{
while ( 1 ) {
...
}
}
图2