https://github.com/sqlite/sqlite/commit/76b77c63f730aa163d82d082c0e1bf648cc4c567 From 76b77c63f730aa163d82d082c0e1bf648cc4c567 Mon Sep 17 00:00:00 2001 From: stephan Date: Mon, 4 Nov 2024 13:59:58 +0000 Subject: [PATCH] Fix two mismatched uses of malloc() and sqlite3_free() in sqlite3_stdio.c, as reported in [forum:7dd7c70038 | forum post 7dd7c70038]. FossilOrigin-Name: 5238959d05bbf3c12f488a55e52f3e9733138993d0365255184dffeb2bf36c03 --- ext/misc/sqlite3_stdio.c | 4 ++-- manifest | 13 +++++++------ manifest.uuid | 2 +- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/ext/misc/sqlite3_stdio.c b/ext/misc/sqlite3_stdio.c index 5bb26084c2..ba37e4be30 100644 --- a/ext/misc/sqlite3_stdio.c +++ b/ext/misc/sqlite3_stdio.c @@ -146,7 +146,7 @@ char *sqlite3_fgets(char *buf, int sz, FILE *in){ ** that into UTF-8. Otherwise, non-ASCII characters all get translated ** into '?'. */ - wchar_t *b1 = malloc( sz*sizeof(wchar_t) ); + wchar_t *b1 = sqlite3_malloc( sz*sizeof(wchar_t) ); if( b1==0 ) return 0; _setmode(_fileno(in), IsConsole(in) ? _O_WTEXT : _O_U8TEXT); if( fgetws(b1, sz/4, in)==0 ){ @@ -212,7 +212,7 @@ int sqlite3_fputs(const char *z, FILE *out){ ** use O_U8TEXT for everything in text mode. */ int sz = (int)strlen(z); - wchar_t *b1 = malloc( (sz+1)*sizeof(wchar_t) ); + wchar_t *b1 = sqlite3_malloc( (sz+1)*sizeof(wchar_t) ); if( b1==0 ) return 0; sz = MultiByteToWideChar(CP_UTF8, 0, z, sz, b1, sz); b1[sz] = 0;