jansson
jansson copied to clipboard
[question] multiple usage of json_set_alloc_funcs
Hello, at the program startup, I set the following custom alloc funcs:
json_set_alloc_funcs (gcry_malloc_secure, gcry_free);
in some other part of my program I would need to use other alloc funcs (without secure memory). Would it be OK to call again json_set_alloc_funcs or could this screw things up for stuff that's still in memory using the previous call?
Example:
- program start:
json_set_alloc_funcs (gcry_malloc_secure, gcry_free); - program loads json into memory
- user call a specific function:
json_set_alloc_funcs (g_malloc0, g_free);- at the end of this specific function
json_set_alloc_funcs (gcry_malloc_secure, gcry_free);is called again
- at the end of this specific function
What do you think?
Thanks!