[PATCH 4/4] Fix a leak in Rebar test data allocation (Valgrind)

Nikolay Sivov nsivov at codeweavers.com
Fri Jan 14 15:28:38 CST 2011


---
 dlls/comctl32/tests/rebar.c |   19 +++++++++----------
 1 files changed, 9 insertions(+), 10 deletions(-)

diff --git a/dlls/comctl32/tests/rebar.c b/dlls/comctl32/tests/rebar.c
index 1856502..3a01756 100644
--- a/dlls/comctl32/tests/rebar.c
+++ b/dlls/comctl32/tests/rebar.c
@@ -208,17 +208,16 @@ typedef struct {
 
 static rbsize_result_t rbsize_init(int cleft, int ctop, int cright, int cbottom, int cyBarHeight, int nRows, int nBands)
 {
-    rbsize_result_t *temp;
+    rbsize_result_t ret;
 
-    temp = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(rbsize_result_t));
-    SetRect(&temp->rcClient, cleft, ctop, cright, cbottom);
-    temp->cyBarHeight = cyBarHeight;
-    temp->nRows = 0;
-    temp->cyRowHeights = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, nRows*sizeof(int));
-    temp->nBands = 0;
-    temp->bands = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, nBands*sizeof(rbband_result_t));
+    SetRect(&ret.rcClient, cleft, ctop, cright, cbottom);
+    ret.cyBarHeight = cyBarHeight;
+    ret.nRows = 0;
+    ret.cyRowHeights = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, nRows*sizeof(int));
+    ret.nBands = 0;
+    ret.bands = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, nBands*sizeof(rbband_result_t));
 
-    return *temp;
+    return ret;
 }
 
 static void rbsize_add_row(rbsize_result_t *rbsr, int rowHeight) {
@@ -234,7 +233,7 @@ static void rbsize_add_band(rbsize_result_t *rbsr, int left, int top, int right,
     rbsr->nBands++;
 }
 
-static rbsize_result_t *rbsize_results = NULL;
+static rbsize_result_t *rbsize_results;
 
 #define rbsize_results_num 27
 
-- 
1.5.6.5


--------------030809000209080601050201--



More information about the wine-patches mailing list