summaryrefslogtreecommitdiffstats
path: root/lib/libfetch
diff options
context:
space:
mode:
authortjr <tjr@FreeBSD.org>2002-10-20 10:36:27 +0000
committertjr <tjr@FreeBSD.org>2002-10-20 10:36:27 +0000
commit8ed112060e6024f58c2e8a461abb5e64a65c8ff2 (patch)
treeab179989f14097a85570a9e0667fa5a101098f24 /lib/libfetch
parent300838722e19232ca14d92207915d9b5168cfcf3 (diff)
downloadFreeBSD-src-8ed112060e6024f58c2e8a461abb5e64a65c8ff2.zip
FreeBSD-src-8ed112060e6024f58c2e8a461abb5e64a65c8ff2.tar.gz
When recycling a cached connection, increment the reference count so that
the heap block does not get freed and reused. This should fix the pkg_add -r crashes that have been happening for months.
Diffstat (limited to 'lib/libfetch')
-rw-r--r--lib/libfetch/ftp.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/libfetch/ftp.c b/lib/libfetch/ftp.c
index 7897adf..0ee7488 100644
--- a/lib/libfetch/ftp.c
+++ b/lib/libfetch/ftp.c
@@ -866,7 +866,7 @@ _ftp_cached_connect(struct url *url, struct url *purl, const char *flags)
if (_ftp_isconnected(url)) {
e = _ftp_cmd(cached_connection, "NOOP");
if (e == FTP_OK || e == FTP_SYNTAX_ERROR)
- return (cached_connection);
+ return (_fetch_ref(cached_connection));
}
/* connect to server */
OpenPOWER on IntegriCloud