icons screen saver: fix memory leak

Fix fBackBitmap and items of fVectorIcons were not released.

Change-Id: I8bf974a9f11852c4b1092490e699b46bd79997eb
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3879
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
This commit is contained in:
Murai Takashi 2021-04-19 20:10:54 +09:00 committed by Adrien Destugues
parent 51b5bca96e
commit fd61ca46f2

View File

@ -65,6 +65,11 @@ IconsSaver::IconsSaver(BMessage* archive, image_id image)
IconsSaver::~IconsSaver()
{
vector_icon* icon;
while ((icon = fVectorIcons.RemoveItemAt((int32)0)) != NULL) {
delete[] icon->data;
free(icon);
}
}
@ -119,6 +124,8 @@ IconsSaver::StopSaver()
{
delete[] fIcons;
fIcons = NULL;
delete fBackBitmap;
fBackBitmap = NULL;
}