changeset 736:48029b8a5478

Free UTF8Data before changing its value.
author Jorge Arellano Cid <jcid@dillo.org>
date Mon, 05 Jan 2009 09:40:14 -0300
parents abdae95b1c9e
children 9727384b6231
files src/cache.c
diffstat 1 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/cache.c	Mon Jan 05 09:38:42 2009 -0300
+++ b/src/cache.c	Mon Jan 05 09:40:14 2009 -0300
@@ -425,6 +425,7 @@
       entry->DataRefcount++;
       _MSG("DataRefcount++: %d\n", entry->DataRefcount);
       if (entry->CharsetDecoder && entry->DataRefcount == 1) {
+         dStr_free(entry->UTF8Data, 1);
          entry->UTF8Data = a_Decode_process(entry->CharsetDecoder,
                                             entry->Data->str,
                                             entry->Data->len);
@@ -760,8 +761,10 @@
       a_Misc_parse_content_type(Type, NULL, NULL, &charset);
       if (charset) {
          entry->CharsetDecoder = a_Decode_charset_init(charset);
-         if (entry->CharsetDecoder)
+         if (entry->CharsetDecoder) {
+            dStr_free(entry->UTF8Data, 1);
             entry->UTF8Data = dStr_new("");
+         }
          dFree(charset);
       }
    }