From 248a53f6bad612213b7cc7f89abeb0b5615543ec Mon Sep 17 00:00:00 2001 From: John Mark Bell Date: Sat, 17 Apr 2010 21:17:08 +0000 Subject: Avoid double free when shrink-wrapping source data on fetch completion. svn path=/trunk/netsurf/; revision=10423 --- content/llcache.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'content') diff --git a/content/llcache.c b/content/llcache.c index 0d20fe8ac..977c03804 100644 --- a/content/llcache.c +++ b/content/llcache.c @@ -1610,7 +1610,8 @@ void llcache_fetch_callback(fetch_msg msg, void *p, const void *data, /* Shrink source buffer to required size */ temp = realloc(object->source_data, object->source_len); - if (temp != NULL) { + /* If source_len is 0, then temp may be NULL */ + if (temp != NULL || object->source_len == 0) { object->source_data = temp; object->source_alloc = object->source_len; } -- cgit v1.2.3