Author: chris_y
Date: Sat Jan 24 06:24:15 2009
New Revision: 6222

URL: http://source.netsurf-browser.org?rev=6222&view=rev
Log:
It's probably a good idea to free memory once we've finished with it.

Modified:
    trunk/netsurf/amiga/font.c

Modified: trunk/netsurf/amiga/font.c
URL: 
http://source.netsurf-browser.org/trunk/netsurf/amiga/font.c?rev=6222&r1=6221&r2=6222&view=diff
==============================================================================
--- trunk/netsurf/amiga/font.c (original)
+++ trunk/netsurf/amiga/font.c Sat Jan 24 06:24:15 2009
@@ -115,7 +115,7 @@
        }
        else
        {
-               uint16 *utf16 = NULL;
+               uint16 *utf16 = NULL, *outf16 = NULL;
                struct OutlineFont *ofont;
                struct GlyphMap *glyph;
                uint32 tx=0,i=0;
@@ -125,6 +125,7 @@
 
                parserutils_charset_utf8_length(string, length, &len);
                if(utf8_to_enc(string,"UTF-16",length,&utf16) != 
UTF8_CONVERT_OK) return;
+               outf16 = utf16;
 
                if(!(ofont = ami_open_outline_font(style))) return 0;
 
@@ -143,6 +144,7 @@
                                        *actual_x = tx;
                                        
if(utf8_from_enc(utf16,"UTF-16",4,&utf8) != UTF8_CONVERT_OK) return;
                                        
parserutils_charset_utf8_char_byte_length(utf8,&utf8len);
+                                       free(utf8);
 
                                        if(x<tx+glyph->glm_X1)
                                        {
@@ -166,6 +168,7 @@
                                utf16 += 2;
                }
                *char_offset = co;
+               free(outf16);
        }
 
        return true;
@@ -226,7 +229,7 @@
        }
        else
        {
-               uint16 *utf16 = NULL;
+               uint16 *utf16 = NULL,*outf16 = NULL;
                struct OutlineFont *ofont;
                struct GlyphMap *glyph;
                uint32 tx=0,i=0;
@@ -234,7 +237,7 @@
 
                parserutils_charset_utf8_length(string, length, &len);
                if(utf8_to_enc(string,"UTF-16",length,&utf16) != 
UTF8_CONVERT_OK) return;
-
+               outf16 = utf16;
                if(!(ofont = ami_open_outline_font(style))) return 0;
 
                *char_offset = 0;
@@ -280,6 +283,7 @@
                        co--;
                }
                *char_offset = co;
+               free(outf16);
        }
 
        return true;
@@ -453,7 +457,7 @@
 
 ULONG ami_unicode_text(struct RastPort *rp,char *string,ULONG length,struct 
css_style *style,ULONG dx, ULONG dy, ULONG c)
 {
-       uint16 *utf16 = NULL;
+       uint16 *utf16 = NULL, *outf16 = NULL;
        struct OutlineFont *ofont;
        struct GlyphMap *glyph;
        ULONG i,gx,gy;
@@ -470,7 +474,7 @@
 
        parserutils_charset_utf8_length(string, length, &len);
        if(utf8_to_enc(string,"UTF-16",length,&utf16) != UTF8_CONVERT_OK) 
return 0;
-
+       outf16 = utf16;
        if(!(ofont = ami_open_outline_font(style))) return 0;
 
        if(rp) 
SetRPAttrs(currp,RPTAG_APenColor,p96EncodeColor(RGBFB_A8B8G8R8,c),TAG_DONE);
@@ -519,6 +523,7 @@
                        utf16 += 2;
        }
 
+       free(outf16);
        return x;
 }
 


_______________________________________________
netsurf-commits mailing list
[email protected]
http://vlists.pepperfish.net/cgi-bin/mailman/listinfo/netsurf-commits-netsurf-browser.org

Reply via email to