libmicrohttpd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [libmicrohttpd] MHD_RESPMEM_PERSISTENT


From: Miguel Sancho
Subject: Re: [libmicrohttpd] MHD_RESPMEM_PERSISTENT
Date: Wed, 25 Jan 2017 15:27:50 +0100

thanks for your responses,

so this code is not safe:
       response = MHD_create_response_from_buffer(size,(void*)buffer,
                                                          MHD_RESPMEM_PERSISTENT);
       ret = MHD_queue_response (connection, 200, response);
       MHD_destroy_response (response);
       free(buffer);


the following work-around seems to work fine:
1) define callback function to notify request completion (with MHD_OPTION_NOTIFY_COMPLETED)

2) do the free() in this callback function
       requestTerminationCallBack(char **buffer)
       {
              free(*buffer);
       }

Regards
Miguel

reply via email to

[Prev in Thread] Current Thread [Next in Thread]