jansson icon indicating copy to clipboard operation
jansson copied to clipboard

[question] multiple usage of json_set_alloc_funcs

Open paolostivanin opened this issue 2 years ago • 0 comments

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

What do you think?

Thanks!

paolostivanin avatar Nov 02 '23 11:11 paolostivanin