From 94a9616d909850703b7c9c9f736bdc82d5494b7f Mon Sep 17 00:00:00 2001 From: Filippos Karapetis Date: Wed, 7 Oct 2009 17:01:19 +0000 Subject: Hopefully fixed a mismatching free() call in gfx_free_pixmap(), originating from getView() svn-id: r44739 --- engines/sci/gfx/gfx_resmgr.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'engines') diff --git a/engines/sci/gfx/gfx_resmgr.cpp b/engines/sci/gfx/gfx_resmgr.cpp index 773d9d4bf5..b3d31ac1c9 100644 --- a/engines/sci/gfx/gfx_resmgr.cpp +++ b/engines/sci/gfx/gfx_resmgr.cpp @@ -550,7 +550,11 @@ gfxr_view_t *GfxResManager::getView(int nr, int *loop, int *cel, int palette) { view->loops[i].cels[j] = gfx_pixmap_alloc_index_data(gfx_new_pixmap(celInfo->width, celInfo->height, nr, i, j)); gfx_pixmap_t *curCel = view->loops[i].cels[j]; curCel->color_key = celInfo->clearKey; - curCel->index_data = guiView->getBitmap(i, j); + // old code uses malloc() here, so we do so as well, as the buffer will be freed with free() in gfx_free_pixmap + curCel->index_data = (byte *)malloc(celInfo->width * celInfo->height); + byte *tmpBuffer = guiView->getBitmap(i, j); + memcpy(curCel->index_data, tmpBuffer, celInfo->width * celInfo->height); + delete tmpBuffer; curCel->flags = 0; curCel->width = celInfo->width; curCel->height = celInfo->height; -- cgit v1.2.3