Shrink source buffer to final length on fetch completion

svn path=/trunk/netsurf/; revision=10373
This commit is contained in:
John Mark Bell 2010-04-11 21:26:20 +00:00
parent 486731e589
commit 4b8c720ac5
1 changed files with 12 additions and 0 deletions

View File

@ -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 */