diff options
author | jsg@openbsd.org <jsg@openbsd.org> | 2017-02-02 10:54:25 +0000 |
---|---|---|
committer | Darren Tucker <dtucker@zip.com.au> | 2017-02-03 14:23:24 +1100 |
commit | 3ec5fa4ba97d4c4853620daea26a33b9f1fe3422 (patch) | |
tree | 03ba8ced0caf88feb5a81d0e0e1556cbccb28708 | |
parent | 858252fb1d451ebb0969cf9749116c8f0ee42753 (diff) |
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
-rw-r--r-- | utf8.c | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: utf8.c,v 1.3 2016/05/30 12:57:21 schwarze Exp $ */ | 1 | /* $OpenBSD: utf8.c,v 1.4 2017/02/02 10:54:25 jsg Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org> | 3 | * Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org> |
4 | * | 4 | * |
@@ -116,6 +116,7 @@ vasnmprintf(char **str, size_t maxsz, int *wp, const char *fmt, va_list ap) | |||
116 | sz = strlen(src) + 1; | 116 | sz = strlen(src) + 1; |
117 | if ((dst = malloc(sz)) == NULL) { | 117 | if ((dst = malloc(sz)) == NULL) { |
118 | free(src); | 118 | free(src); |
119 | ret = -1; | ||
119 | goto fail; | 120 | goto fail; |
120 | } | 121 | } |
121 | 122 | ||