[openssh-commits] [openssh] 01/06: fix leak of error path; GHPR681 from metsw24-max

git+noreply at mindrot.org git+noreply at mindrot.org
Mon Jun 29 17:52:17 AEST 2026


This is an automated email from the git hooks/post-receive script.

djm pushed a commit to branch master
in repository openssh.

commit ef6bef31de60b077cb7da954b202d65156fd510e
Author: Damien Miller <djm at mindrot.org>
AuthorDate: Mon Jun 29 17:15:10 2026 +1000

    fix leak of error path; GHPR681 from metsw24-max
    
    ok dtucker
---
 openbsd-compat/bsd-cygwin_util.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/openbsd-compat/bsd-cygwin_util.c b/openbsd-compat/bsd-cygwin_util.c
index 9ede21d24..c2fd36fee 100644
--- a/openbsd-compat/bsd-cygwin_util.c
+++ b/openbsd-compat/bsd-cygwin_util.c
@@ -198,8 +198,10 @@ _match_pattern(const char *s, const char *pattern)
 		return 0;
 	ws = (wchar_t *) xcalloc(len + 1, sizeof (wchar_t));
 	mbstowcs(ws, s, len + 1);
-	if ((len = mbstowcs(NULL, pattern, 0)) == (size_t) -1)
+	if ((len = mbstowcs(NULL, pattern, 0)) == (size_t) -1) {
+		free(ws);
 		return 0;
+	}
 	wpattern = (wchar_t *) xcalloc(len + 1, sizeof (wchar_t));
 	mbstowcs(wpattern, pattern, len + 1);
 	ret = __match_pattern (ws, wpattern);

-- 
To stop receiving notification emails like this one, please contact
djm at mindrot.org.


More information about the openssh-commits mailing list