Esempio n. 1
0
/*
*  Dup Some memory.
*/
void * sfmemcap_dupmem( MEMCAP * mc, void * src, unsigned long n )
{
    void * data = (char *)sfmemcap_alloc( mc, n );
    if(data == NULL)
    {
        return  0;
    }

    memcpy( data, src, n );

    return data;
}
Esempio n. 2
0
/*
*  String Dup Some memory.
*/
char * sfmemcap_strdup( MEMCAP * mc, const char *str )
{
    char *data = NULL;
    int data_size;

    data_size = strlen(str) + 1;
    data = (char *)sfmemcap_alloc(mc, data_size);

    if(data == NULL)
    {
        return  0 ;
    }

    SnortStrncpy(data, str, data_size);

    return data;
}
Esempio n. 3
0
/*
 * Private Malloc - abstract the memory system
 */
static 
void * s_malloc( SFXHASH * t, int n )
{
    return sfmemcap_alloc( &t->mc, n );
}