From: Daniel Stenberg Date: Tue, 21 Nov 2000 15:36:38 +0000 (+0000) Subject: added some defensive code around the GetHost()'s third argument result X-Git-Tag: curl-7_5~72 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2a5e68ea895136168dd6d0d753299e9b04fd85a1;p=thirdparty%2Fcurl.git added some defensive code around the GetHost()'s third argument result --- diff --git a/lib/url.c b/lib/url.c index d4db4428e0..a88d1a2143 100644 --- a/lib/url.c +++ b/lib/url.c @@ -1312,7 +1312,7 @@ static CURLcode _connect(CURL *curl, CURLconnect **in_connect) if (data->device && (strlen(data->device)<255)) { struct sockaddr_in sa; struct hostent *h=NULL; - char *hostdataptr; + char *hostdataptr=NULL; size_t size; char myhost[256] = ""; unsigned long in; @@ -1425,7 +1425,8 @@ static CURLcode _connect(CURL *curl, CURLconnect **in_connect) return CURLE_HTTP_PORT_FAILED; } - free(hostdataptr); /* allocated by GetHost() */ + if(hostdataptr) + free(hostdataptr); /* allocated by GetHost() */ } /* end of device selection support */ #endif /* end of HAVE_INET_NTOA */