diff options
author | markus@openbsd.org <markus@openbsd.org> | 2020-03-06 19:12:55 +0100 |
---|---|---|
committer | Damien Miller <djm@mindrot.org> | 2020-03-13 03:13:30 +0100 |
commit | 6fb6f186cb62a6370fba476b6a03478a1e95c30d (patch) | |
tree | d971345446236ac6e506ff1847579486b778a8fd /utf8.c | |
parent | upstream: sshpkt_fatal() does not return; ok djm (diff) | |
download | openssh-6fb6f186cb62a6370fba476b6a03478a1e95c30d.tar.xz openssh-6fb6f186cb62a6370fba476b6a03478a1e95c30d.zip |
upstream: vasnmprintf allocates str and returns -1; ok djm
OpenBSD-Commit-ID: dae4c9e83d88471bf3b3f89e3da7a107b44df11c
Diffstat (limited to '')
-rw-r--r-- | utf8.c | 10 |
1 files changed, 6 insertions, 4 deletions
@@ -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@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); |