aboutsummaryrefslogtreecommitdiff
path: root/src/cache.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/cache.c')
-rw-r--r--src/cache.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/cache.c b/src/cache.c
index 8d01c40e..8ab9e1a4 100644
--- a/src/cache.c
+++ b/src/cache.c
@@ -424,7 +424,8 @@ static void Cache_ref_data(CacheEntry_t *entry)
if (entry) {
entry->DataRefcount++;
_MSG("DataRefcount++: %d\n", entry->DataRefcount);
- if (entry->CharsetDecoder && entry->DataRefcount == 1) {
+ if (entry->CharsetDecoder &&
+ (!entry->UTF8Data || entry->DataRefcount == 1)) {
dStr_free(entry->UTF8Data, 1);
entry->UTF8Data = a_Decode_process(entry->CharsetDecoder,
entry->Data->str,
@@ -518,7 +519,7 @@ const char *a_Cache_set_content_type(const DilloUrl *url, const char *ctype,
entry->CharsetDecoder = a_Decode_charset_init(charset);
dFree(charset);
curr = Cache_current_content_type(entry);
-
+
/* Invalidate UTF8Data */
dStr_free(entry->UTF8Data, 1);
entry->UTF8Data = NULL;