Hi Nicolas, In addition to Christian's answer, I'd like to point your attention to the fact that for your case no patch is needed.
Just use 'MHD_create_response_from_buffer_with_free_callback()' and you will be able to use any custom 'free()' function. For strings allocated by MHD, you should use 'MHD_free()'. So memory management in MHD and in application is already isolated, you can you any allocation routines as long as you will correctly use MHD API. -- Wishes, Evgney 21.07.2019 22:28, Nicolas Mora wrote: > I happened to see that MHD doesn't allow to use different > malloc/calloc/free functions than the one provided by libc. > > This would be useful if the underlying app using MHD uses different > allocating functions like Hoard: http://www.hoard.org/ > More specifically, when using MHD_RESPMEM_MUST_FREE in a response > allocated with a different malloc() function, there would be problems. > > I can submit a patch for it. > Basically, I'd do it by adding functions like this: > > void MHD_set_alloc_funcs(MHD_malloc_t malloc_fn, MHD_calloc_t calloc_fn, > MHD_free_t free_fn); > void MHD_get_alloc_funcs(MHD_malloc_t * malloc_fn, MHD_calloc_t * > calloc_fn, MHD_free_t * free_fn); > > I didn't see any use of realloc() in the source code, so I wouldn't > allow to change it. > > Then, all internal call to malloc()/calloc()/free() would be replaced by > MHD_malloc()/MHD_calloc()/MHD_free() > > How about that? Any feedback? > > /Nicolas >
signature.asc
Description: OpenPGP digital signature