Fix allocation size in vaswprintf
This is so embarrassing. It only started crashing once it had strings that were long enough, and then it took me so long to notice this mistake. I was worried I was still doing va_list wrong somehow.master
parent
3f3fa34d8a
commit
1c2b038396
2
pls.c
2
pls.c
|
@ -47,7 +47,7 @@ int vaswprintf(wchar_t **ret, const wchar_t *format, va_list ap) {
|
||||||
*ret = NULL;
|
*ret = NULL;
|
||||||
|
|
||||||
for (size_t cap = 2 * wcslen(format);; cap *= 2) {
|
for (size_t cap = 2 * wcslen(format);; cap *= 2) {
|
||||||
wchar_t *buf = realloc(*ret, 1 + cap);
|
wchar_t *buf = realloc(*ret, sizeof(*buf) * (1 + cap));
|
||||||
if (!buf) goto fail;
|
if (!buf) goto fail;
|
||||||
*ret = buf;
|
*ret = buf;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue