From 6ca7654ec7e64a2076a6c77b032081767327bd7f Mon Sep 17 00:00:00 2001 From: Nikolay Sivov Date: Wed, 6 Jan 2010 22:38:54 +0300 Subject: [PATCH] comctl32/listview: Fix memory leak on subrange deletion. --- dlls/comctl32/listview.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/dlls/comctl32/listview.c b/dlls/comctl32/listview.c index cf7c77a120e..d98b108b3f5 100644 --- a/dlls/comctl32/listview.c +++ b/dlls/comctl32/listview.c @@ -3183,28 +3183,30 @@ static BOOL ranges_del(RANGES ranges, RANGE range) TRACE("(%s)\n", debugrange(&range)); ranges_check(ranges, "before del"); - + /* we don't use DPAS_SORTED here, since we need * * to find the first overlapping range */ index = DPA_Search(ranges->hdpa, &range, 0, ranges_cmp, 0, 0); - while(index != -1) + while(index != -1) { chkrgn = DPA_GetPtr(ranges->hdpa, index); - - TRACE("Matches range %s @%d\n", debugrange(chkrgn), index); + + TRACE("Matches range %s @%d\n", debugrange(chkrgn), index); /* case 1: Same range */ if ( (chkrgn->upper == range.upper) && (chkrgn->lower == range.lower) ) { DPA_DeletePtr(ranges->hdpa, index); + Free(chkrgn); break; } /* case 2: engulf */ else if ( (chkrgn->upper <= range.upper) && - (chkrgn->lower >= range.lower) ) + (chkrgn->lower >= range.lower) ) { DPA_DeletePtr(ranges->hdpa, index); + Free(chkrgn); } /* case 3: overlap upper */ else if ( (chkrgn->upper <= range.upper) &&