From 81beb955c886f032d08f5e30b93f7fac298cdbbf Mon Sep 17 00:00:00 2001 From: "Dimitrie O. Paun" Date: Fri, 27 Sep 2002 22:47:00 +0000 Subject: [PATCH] Remove item from the list, if we fail to initialize it at insert time. --- dlls/comctl32/listview.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/dlls/comctl32/listview.c b/dlls/comctl32/listview.c index 8af17dee7f1..70553a57ba0 100644 --- a/dlls/comctl32/listview.c +++ b/dlls/comctl32/listview.c @@ -6619,7 +6619,11 @@ static LRESULT LISTVIEW_InsertItemT(LISTVIEW_INFO *infoPtr, LPLVITEMW lpLVItem, hdpaSubItems ); if (nItem == -1) goto fail; - if (!LISTVIEW_SetItemT(infoPtr, lpLVItem, isW)) goto fail; + if (!LISTVIEW_SetItemT(infoPtr, lpLVItem, isW)) + { + DPA_DeletePtr(infoPtr->hdpaItems, nItem); + goto fail; + } /* if we're sorted, sort the list, and update the index */ if (is_sorted) @@ -6630,7 +6634,8 @@ static LRESULT LISTVIEW_InsertItemT(LISTVIEW_INFO *infoPtr, LPLVITEMW lpLVItem, { ERR("We can't find the item we just inserted, possible memory corruption."); /* we can't remove it from the list if we can't find it, so just fail */ - goto fail; + /* we don't deallocate memory here, as it will probably cause more problems */ + return -1; } }