[openssh-commits] [openssh] 02/22: upstream: vasnmprintf allocates str and returns -1; ok djm

git+noreply at mindrot.org git+noreply at mindrot.org
Fri Mar 13 13:18:39 AEDT 2020


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

djm pushed a commit to branch master
in repository openssh.

commit 6fb6f186cb62a6370fba476b6a03478a1e95c30d
Author: markus at openbsd.org <markus at openbsd.org>
Date:   Fri Mar 6 18:12:55 2020 +0000

    upstream: vasnmprintf allocates str and returns -1; ok djm
    
    OpenBSD-Commit-ID: dae4c9e83d88471bf3b3f89e3da7a107b44df11c
---
 utf8.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/utf8.c b/utf8.c
index db7cb8f3..b3d30047 100644
--- a/utf8.c
+++ b/utf8.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: utf8.c,v 1.8 2018/08/21 13:56:27 schwarze Exp $ */
+/* $OpenBSD: utf8.c,v 1.9 2020/03/06 18:12:55 markus Exp $ */
 /*
  * Copyright (c) 2016 Ingo Schwarze <schwarze at openbsd.org>
  *
@@ -241,7 +241,7 @@ int
 snmprintf(char *str, size_t sz, int *wp, const char *fmt, ...)
 {
 	va_list	 ap;
-	char	*cp;
+	char	*cp = NULL;
 	int	 ret;
 
 	va_start(ap, fmt);
@@ -263,11 +263,13 @@ snmprintf(char *str, size_t sz, int *wp, const char *fmt, ...)
 int
 vfmprintf(FILE *stream, const char *fmt, va_list ap)
 {
-	char	*str;
+	char	*str = NULL;
 	int	 ret;
 
-	if ((ret = vasnmprintf(&str, INT_MAX, NULL, fmt, ap)) < 0)
+	if ((ret = vasnmprintf(&str, INT_MAX, NULL, fmt, ap)) < 0) {
+		free(str);
 		return -1;
+	}
 	if (fputs(str, stream) == EOF)
 		ret = -1;
 	free(str);

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


More information about the openssh-commits mailing list