upstream commit

In vasnmprintf() return an error if malloc fails and
don't set a function argument to the address of free'd memory.

ok djm@

Upstream-ID: 1efffffff2f51d53c9141f245b90ac23d33b9779
This commit is contained in:
jsg@openbsd.org 2017-02-02 10:54:25 +00:00 committed by Darren Tucker
parent 858252fb1d
commit 3ec5fa4ba9
1 changed files with 2 additions and 1 deletions

3
utf8.c
View File

@ -1,4 +1,4 @@
/* $OpenBSD: utf8.c,v 1.3 2016/05/30 12:57:21 schwarze Exp $ */
/* $OpenBSD: utf8.c,v 1.4 2017/02/02 10:54:25 jsg Exp $ */
/*
* Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org>
*
@ -116,6 +116,7 @@ vasnmprintf(char **str, size_t maxsz, int *wp, const char *fmt, va_list ap)
sz = strlen(src) + 1;
if ((dst = malloc(sz)) == NULL) {
free(src);
ret = -1;
goto fail;
}