From 4b8c720ac530d76d926fd7920d4f1d8c855c564d Mon Sep 17 00:00:00 2001 From: John Mark Bell Date: Sun, 11 Apr 2010 21:26:20 +0000 Subject: Shrink source buffer to final length on fetch completion svn path=/trunk/netsurf/; revision=10373 --- content/llcache.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'content/llcache.c') diff --git a/content/llcache.c b/content/llcache.c index 1cff74f53..655265bdb 100644 --- a/content/llcache.c +++ b/content/llcache.c @@ -1548,10 +1548,22 @@ void llcache_fetch_callback(fetch_msg msg, void *p, const void *data, break; case FETCH_FINISHED: /* Finished fetching */ + { + uint8_t *temp; + object->fetch.state = LLCACHE_FETCH_COMPLETE; object->fetch.fetch = NULL; + /* Shrink source buffer to required size */ + temp = realloc(object->source_data, + object->source_len); + if (temp != NULL) { + object->source_data = temp; + object->source_alloc = object->source_len; + } + llcache_object_cache_update(object); + } break; /* Out-of-band information */ -- cgit v1.2.3