In fetch_url(), don't call freeaddrinfo(res0) too early, as we use pointers

to its contents later in the function.
Problem found by Onno van der Linden.
This commit is contained in:
lukem 2005-04-10 03:13:23 +00:00
parent 78fc87188c
commit ec95ee57f7
2 changed files with 6 additions and 5 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: fetch.c,v 1.155 2005/01/12 22:37:41 lukem Exp $ */
/* $NetBSD: fetch.c,v 1.156 2005/04/10 03:13:23 lukem Exp $ */
/*-
* Copyright (c) 1997-2004 The NetBSD Foundation, Inc.
@ -41,7 +41,7 @@
#include <sys/cdefs.h>
#ifndef lint
__RCSID("$NetBSD: fetch.c,v 1.155 2005/01/12 22:37:41 lukem Exp $");
__RCSID("$NetBSD: fetch.c,v 1.156 2005/04/10 03:13:23 lukem Exp $");
#endif /* not lint */
/*
@ -732,7 +732,6 @@ fetch_url(const char *url, const char *proxyenv, char *proxyauth, char *wwwauth)
/* success */
break;
}
freeaddrinfo(res0);
if (s < 0) {
warn("Can't connect to %s", host);
@ -1275,6 +1274,8 @@ fetch_url(const char *url, const char *proxyenv, char *proxyauth, char *wwwauth)
close(s);
if (closefunc != NULL && fout != NULL)
(*closefunc)(fout);
if (res0)
freeaddrinfo(res0);
FREEPTR(savefile);
FREEPTR(user);
FREEPTR(pass);

View File

@ -1,4 +1,4 @@
/* $NetBSD: version.h,v 1.44 2005/01/12 22:37:41 lukem Exp $ */
/* $NetBSD: version.h,v 1.45 2005/04/10 03:13:23 lukem Exp $ */
/*-
* Copyright (c) 1999-2005 The NetBSD Foundation, Inc.
* All rights reserved.
@ -40,5 +40,5 @@
#endif
#ifndef FTP_VERSION
#define FTP_VERSION "20050112"
#define FTP_VERSION "20050410"
#endif