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

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


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

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

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

---

 dlls/comctl32/tests/toolbar.c |   17 ++++++++---------
 1 files changed, 8 insertions(+), 9 deletions(-)

diff --git a/dlls/comctl32/tests/toolbar.c b/dlls/comctl32/tests/toolbar.c
index 75640a8..280a333 100644
--- a/dlls/comctl32/tests/toolbar.c
+++ b/dlls/comctl32/tests/toolbar.c
@@ -708,16 +708,15 @@ typedef struct
 } tbsize_result_t;
 
 tbsize_result_t init_tbsize_result(int nButtonsAlloc, int cleft, int ctop, int cright, int cbottom, int minx, int miny) {
-    tbsize_result_t *temp;
+    tbsize_result_t ret;
 
-    temp = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(tbsize_result_t));
-    SetRect(&temp->rcClient, cleft, ctop, cright, cbottom);
-    temp->szMin.cx = minx;
-    temp->szMin.cy = miny;
-    temp->nButtons = 0;
-    temp->prcButtons = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, nButtonsAlloc*sizeof(RECT));
+    SetRect(&ret.rcClient, cleft, ctop, cright, cbottom);
+    ret.szMin.cx = minx;
+    ret.szMin.cy = miny;
+    ret.nButtons = 0;
+    ret.prcButtons = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, nButtonsAlloc*sizeof(RECT));
 
-    return *temp;
+    return ret;
 }
 
 void tbsize_addbutton(tbsize_result_t *tbsr, int left, int top, int right, int bottom) {
@@ -729,7 +728,7 @@ void tbsize_addbutton(tbsize_result_t *tbsr, int left, int top, int right, int b
 #define STRING1 "MMMMMMMMMMMMM"
 #define STRING2 "Tst"
 
-tbsize_result_t *tbsize_results = NULL;
+static tbsize_result_t *tbsize_results;
 
 #define tbsize_results_num 24
 




More information about the wine-cvs mailing list