Hi,
 
Still working on my new block reader.  To recap, I’ve defined a new pcapng block type and written a dissector.  The first thing I have to do is read the new block type, and Wireshark provides a framework to do this.  In the new block reader
 I define some space like this:
 
            tdb_namespace = wmem_strdup_printf(wmem_file_scope(), "%s", option_block->option_data);
 
Eventually the wmem_strdup_printf(…) execution calls this function:
 
void *
wmem_alloc(wmem_allocator_t *allocator, const size_t size)
{
    if (allocator == NULL) {
        return g_malloc(size);
    }
 
    if (!allocator->in_scope) // debug code
        while (FALSE); // debug code
 
    g_assert(allocator->in_scope);
 
    if (size == 0) {
        return NULL;
    }
 
    return allocator->walloc(allocator->private_data, size);
}
 
The g_assert intermittently fails.  If I open one file containing the new block, allocator->in_scope is true.  If I call another it’s false.
 
The block read is called before we start dissecting the contents with the dissector code.
 
- At what point is wmem_file_scope in scope?
 - Should it be when my block reader is called or is it only guaranteed when the dissector code is called?
 
 
Thanks and regards…Paul