From eb839492d5500cf0338661197702239cfdf7196c Mon Sep 17 00:00:00 2001 From: Colin Watson Date: Sun, 23 Nov 2008 14:44:44 +0000 Subject: Fix double-free when failing to parse a forwarding specification given using ~C (closes: #505330; forwarded upstream as https://bugzilla.mindrot.org/show_bug.cgi?id=1539). --- readconf.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'readconf.c') diff --git a/readconf.c b/readconf.c index 7ad5a8e18..043673ced 100644 --- a/readconf.c +++ b/readconf.c @@ -1334,9 +1334,13 @@ parse_forward(Forward *fwd, const char *fwdspec) return (i); fail_free: - if (fwd->connect_host != NULL) + if (fwd->connect_host != NULL) { xfree(fwd->connect_host); - if (fwd->listen_host != NULL) + fwd->connect_host = NULL; + } + if (fwd->listen_host != NULL) { xfree(fwd->listen_host); + fwd->connect_host = NULL; + } return (0); } -- cgit v1.2.3