balance sk_malloc with sk_free (instead of delete[]) in SkAutoUCS2
authormike@reedtribe.org <mike@reedtribe.org@2bbb7eff-a529-9590-31e7-b0007b416f81>
Sun, 10 Apr 2011 00:44:32 +0000 (00:44 +0000)
committermike@reedtribe.org <mike@reedtribe.org@2bbb7eff-a529-9590-31e7-b0007b416f81>
Sun, 10 Apr 2011 00:44:32 +0000 (00:44 +0000)
patch submitted by alean2...@gmail.com

git-svn-id: http://skia.googlecode.com/svn/trunk@1094 2bbb7eff-a529-9590-31e7-b0007b416f81

src/core/SkString.cpp

index b8f99c7..8a1591a 100644 (file)
@@ -612,23 +612,21 @@ void SkString::swap(SkString& other)
 
 /////////////////////////////////////////////////////////////////////////////////
 
-SkAutoUCS2::SkAutoUCS2(const char utf8[])
-{
+SkAutoUCS2::SkAutoUCS2(const char utf8[]) {
     size_t len = strlen(utf8);
     fUCS2 = (uint16_t*)sk_malloc_throw((len + 1) * sizeof(uint16_t));
 
     uint16_t* dst = fUCS2;
-    for (;;)
-    {
-        SkUnichar   uni = SkUTF8_NextUnichar(&utf8);
+    for (;;) {
+        SkUnichar uni = SkUTF8_NextUnichar(&utf8);
         *dst++ = SkToU16(uni);
-        if (uni == 0)
+        if (uni == 0) {
             break;
+        }
     }
     fCount = (int)(dst - fUCS2);
 }
 
-SkAutoUCS2::~SkAutoUCS2()
-{
-    delete[] fUCS2;
+SkAutoUCS2::~SkAutoUCS2() {
+    sk_free(fUCS2);
 }