Nikolay Sivov : comctl32/tests: Fix a leak in rebar test data allocation ( Valgrind).

Alexandre Julliard julliard at winehq.org
Mon Jan 17 10:59:39 CST 2011


Module: wine
Branch: master
Commit: 6869f89a3078f0717a14dfeec444b7f6f1988551
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=6869f89a3078f0717a14dfeec444b7f6f1988551

Author: Nikolay Sivov <nsivov at codeweavers.com>
Date:   Sat Jan 15 00:28:38 2011 +0300

comctl32/tests: Fix a leak in rebar test data allocation (Valgrind).

---

 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
 




More information about the wine-cvs mailing list