[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [libmicrohttpd] problem with memory leaks
From: |
Ondřej Odcházel |
Subject: |
Re: [libmicrohttpd] problem with memory leaks |
Date: |
Tue, 15 Mar 2011 14:39:58 +0100 |
thanks,
memory leak was on another place,
Ondra
Dne 15. března 2011 13:43 Christian Grothoff <address@hidden> napsal(a):
> Hi!
>
> While I don't see anything directly wrong, the better method would have been:
>
> MHD_create_response_from_buffer (strlen(page.c_str()), page.c_str(),
> MHD_RESPMEM_MUST_COPY);
>
> Overall, I suggest you use valgrind on your app, maybe the leak is entirely
> elsewhere?
>
> Happy hacking,
>
> Christian
>
> On Tuesday 15 March 2011 09:45:49 Ondřej Odcházel wrote:
>> Hi,
>>
>> I am confused with the way, how to create dynamic string at function
>> "answer_to_connection" without memory leaks. I generate some "string
>> page" and want to pass it like
>>
>> string page = getSomeRandomString();
>> struct MHD_Response *response;
>> int ret;
>> response = MHD_create_response_from_data (strlen(page.c_str()),
>> strdup(page.c_str()), MHD_YES, MHD_YES);
>> ret = MHD_queue_response (connection, status_code, response);
>> MHD_destroy_response (response);
>> return ret;
>>
>> but i have problems with memory leaks. Do you know, where the problem can
>> be?
>>
>> Thanks,
>>
>> Ondra
>