From 869d34232b482f60f17549e1d374c1a69a53fce7 Mon Sep 17 00:00:00 2001 From: Richard Wilson Date: Sun, 3 Dec 2006 20:53:56 +0000 Subject: Release temporary PNG/JNG memory as soon as possible svn path=/trunk/netsurf/; revision=3101 --- image/mng.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'image') diff --git a/image/mng.c b/image/mng.c index 37ca1460a..b0a94daf1 100644 --- a/image/mng.c +++ b/image/mng.c @@ -307,6 +307,11 @@ bool nsmng_convert(struct content *c, int width, int height) { c->data.mng.opaque_test_pending = (c->type == CONTENT_PNG) || (c->type == CONTENT_JNG); if (c->data.mng.opaque_test_pending) bitmap_set_opaque(c->bitmap, false); + + /* free associated memory except for mngs where it may be subsequently needed for + * animation decoding. */ + if (c->type != CONTENT_MNG) + mng_cleanup(&c->data.mng.handle); return true; } @@ -432,7 +437,8 @@ void nsmng_destroy(struct content *c) { /* Cleanup the MNG structure and release the canvas memory */ schedule_remove(nsmng_animate, c); - mng_cleanup(&c->data.mng.handle); + if (c->type == CONTENT_MNG) + mng_cleanup(&c->data.mng.handle); if (c->bitmap) bitmap_destroy(c->bitmap); free(c->title); -- cgit v1.2.3