RE: [PATCH] http.c
"Michael Mulcahy" <[email protected]>
| Newsgroups | gmane.comp.mobile.kannel.devel |
|---|---|
| Message-ID | <[email protected]> |
The problem is with the calling of "parse_url" in the code. "parse_url" is called twice when a http request is being made. It is the second call that causes the leak. the "write_request_thread" function invokes "get_connection", this calls "parse_url" and populates the trans->host field. then "write_request_thread" invokes "send_request", this calls "parse_url" again and populates the trans->host fields. However send_request does not destroy the trans->host that has already been allocated. cheers, michael. ANAM Wireless Internet Solutions http://www.anam.com mailto:[email protected] +353 1 284 7555 Castle Yard, Saint Patrick's Road, Dalkey, County Dublin, Ireland > -----Original Message----- > From: [email protected] > [mailto:[email protected]]On Behalf Of Stipe Tolj > Sent: 03 December 2002 14:25 > To: Nisan Bloch > Cc: [email protected] > Subject: Re: [PATCH] http.c > > > > the check for != NULL is not necessary, yes. But the > octstr_destroy is, as > > in http.c:parse_url:1155 , host is created. > > *host = octstr_copy(url, prefix_len, host_len); > > but the host is inside the HTTPServe trans structure, it should be > free'ed there, see gwlib/http.c:616: > > static void server_destroy(void *p) > { > HTTPServer *trans; > > trans = p; > octstr_destroy(trans->url); > http_destroy_headers(trans->request_headers); > trans->request_headers = NULL; > octstr_destroy(trans->request_body); > entity_destroy(trans->response); > octstr_destroy(trans->host); > gw_free(trans); > } > > and the previous server_create() garantees that the ->host is NULLed. > > Stipe > > [email protected] > ------------------------------------------------------------------- > Wapme Systems AG > > Vogelsanger Weg 80 > 40470 Düsseldorf > > Tel: +49-211-74845-0 > Fax: +49-211-74845-299 > > E-Mail: [email protected] > Internet: http://www.wapme-systems.de > ------------------------------------------------------------------- > wapme.net - wherever you are