From e4c4c7343c7547475d31eba4791153b796b4707e Mon Sep 17 00:00:00 2001 From: Takuro Ashie Date: Thu, 7 Apr 2022 13:57:55 +0900 Subject: [PATCH] Win32: Plug potential memory leaks --- src/win32_window.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/win32_window.c b/src/win32_window.c index 23d0d4ad..5dcfd1ed 100644 --- a/src/win32_window.c +++ b/src/win32_window.c @@ -868,10 +868,10 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM l if (ctext != window->ctext) { unsigned int* preeditText = _glfw_realloc(window->preeditText, sizeof(unsigned int)*ctext); if (preeditText == NULL) { - return 0; _glfw_free(buffer); _glfw_free(attributes); _glfw_free(clauses); + return 0; } window->preeditText = preeditText; window->ctext = ctext; @@ -894,10 +894,10 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM l if (cblocks != window->cblocks) { int* blocks = _glfw_realloc(window->preeditAttributeBlocks, sizeof(int)*cblocks); if (blocks == NULL) { - return 0; _glfw_free(buffer); _glfw_free(attributes); _glfw_free(clauses); + return 0; } window->preeditAttributeBlocks = blocks; window->cblocks = cblocks;