[PATCH 1/2] kernel32: Fix memory leak in WCEL_MoveToHist.

Alex Henrie alexhenrie24 at gmail.com
Thu Jun 23 02:25:23 CDT 2016


Cc: Eric Pouech <eric.pouech at orange.fr>

Coverity #713501, "Variable data going out of scope leaks the storage it
points to."

Signed-off-by: Alex Henrie <alexhenrie24 at gmail.com>
---
 dlls/kernel32/editline.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/dlls/kernel32/editline.c b/dlls/kernel32/editline.c
index b436a50..bcfdece 100644
--- a/dlls/kernel32/editline.c
+++ b/dlls/kernel32/editline.c
@@ -428,9 +428,9 @@ static void    WCEL_MoveToHist(WCEL_Context* ctx, int idx)
     if (WCEL_Grow(ctx, len))
     {
 	WCEL_InsertString(ctx, data);
-	HeapFree(GetProcessHeap(), 0, data);
 	ctx->histPos = idx;
     }
+    HeapFree(GetProcessHeap(), 0, data);
 }
 
 static void    WCEL_FindPrevInHist(WCEL_Context* ctx)
-- 
2.9.0




More information about the wine-patches mailing list