summaryrefslogtreecommitdiff
path: root/image
diff options
context:
space:
mode:
authorRichard Wilson <rjw@netsurf-browser.org>2006-12-03 20:53:56 +0000
committerRichard Wilson <rjw@netsurf-browser.org>2006-12-03 20:53:56 +0000
commit869d34232b482f60f17549e1d374c1a69a53fce7 (patch)
tree9fc7523d1c8e751f0bb28844b3315b934cb9884f /image
parent74115a7a0d6a04f3d2e8164c5b8fe212f34e5d4c (diff)
downloadnetsurf-869d34232b482f60f17549e1d374c1a69a53fce7.tar.gz
netsurf-869d34232b482f60f17549e1d374c1a69a53fce7.tar.bz2
Release temporary PNG/JNG memory as soon as possible
svn path=/trunk/netsurf/; revision=3101
Diffstat (limited to 'image')
-rw-r--r--image/mng.c8
1 files changed, 7 insertions, 1 deletions
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);