libmicrohttpd
[Top][All Lists]
Advanced

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

Re: [libmicrohttpd] Is there something like MHD_free() ?


From: Tim Rühsen
Subject: Re: [libmicrohttpd] Is there something like MHD_free() ?
Date: Mon, 09 Oct 2017 19:24:16 +0200
User-agent: KMail/5.2.3 (Linux/4.13.0-1-amd64; KDE/5.37.0; x86_64; ; )

Hi Christian,

On Montag, 9. Oktober 2017 17:46:32 CEST Christian Grothoff wrote:
> Hi Tim,
> 
> We definitively don't have MHD_free() today.
> 
> I'm not aware of any API call where MHD returns a pointer to the
> application that the application is expected to free.

MHD_basic_auth_get_username_password ?

The docs say the pass and user should be free'd:

10.1 Using Basic Authentication

Function: char * MHD_basic_auth_get_username_password (struct MHD_Connection 
*connection, char** password)

    Get the username and password from the basic authorization header sent by 
the client. Return NULL if no username could be found, a pointer to the 
username if found. If returned value is not NULL, the value must be free()’ed.

    password reference a buffer to store the password. It can be NULL. If 
returned value is not NULL, the value must be free()’ed. 


Regards, Tim

> There is one case in reverse, where for a response the application can
> give a pointer to MHD which MHD will then free(), namely
> MHD_RESPMEM_MUST_FREE.  Thus, using this may be unsafe on W32 as here
> the application allocates and MHD frees.  However, this is purely
> intended as an optimization to avoid a copy.
> 
> Happy hacking!
> 
> Christian
> 
> On 10/09/2017 04:38 PM, Tim Rühsen wrote:
> > Hi,
> > 
> > a library included free() function is basically needed on systems where
> > the library malloc heap is different from the caller's malloc heap,
> > which happens on Windows when the library is a separate DLL.
> > 
> > 
> > So, is there (or could we have) something like
> > 
> > void MHD_free(void *ptr)
> > {
> > 
> >         free(ptr);
> > 
> > }
> > 
> > ?
> > 
> > 
> > With Best Regards, Tim

Attachment: signature.asc
Description: This is a digitally signed message part.


reply via email to

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