Re: [PATCH] http.c

Stipe Tolj <[email protected]>
Newsgroups gmane.comp.mobile.kannel.devel
Organization Wapme Systems AG
Message-ID <[email protected]>
Hi Nisan

Nisan Bloch wrote:
> 
> Hi
> 
> small memory leak in http.c,
> 
> --- gwlib/http.c        Mon Nov 18 08:02:13 2002
> +++ ../../gateway-cvsup/gwlib/http.c    Mon Nov 25 11:45:50 2002
> @@ -1226,6 +1226,10 @@
>     path = NULL;
>     request = NULL;
> 
> +  if (trans->host != NULL)
> +         octstr_destroy(trans->host);
> +  trans->host = NULL;
> +
>     if (parse_url(trans->url, &trans->host, &trans->port, &path, &trans->ssl,
>                  &trans->username, &trans->password) == -1)

I don't think this is necessary, see gwlib/octstr.c:244:

void octstr_destroy(Octstr *ostr)
{
    if (ostr != NULL) {
        seems_valid(ostr);
	if (!ostr->immutable) {
            gw_free(ostr->data);
            gw_free(ostr);
        }
    }
}

which means octstr_destroy() is only trying to free memory if the ostr
is not null. This implies that explicit checking of the Octstr before
calling octstr_destroy() is not necessary. Right?!

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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.