]> git.donarmstrong.com Git - lilypond.git/commitdiff
pdf-scheme: use malloc and g_free to avoid mixing new/free in scm_take_str
authorReinhold Kainhofer <reinhold@kainhofer.com>
Tue, 23 Aug 2011 15:24:10 +0000 (17:24 +0200)
committerReinhold Kainhofer <reinhold@kainhofer.com>
Tue, 23 Aug 2011 16:42:26 +0000 (18:42 +0200)
lily/pdf-scheme.cc

index ecfe5c4f01d2e973cfedf9648a9274031957ebb9..13e8389ecec7b42a1831c4001090b25ff54e9474 100644 (file)
@@ -58,11 +58,11 @@ LY_DEFINE (ly_encode_string_for_pdf, "ly:encode-string-for-pdf",
        * though), we have to prepend it manually. */
       if (g_without_BOM) // conversion to UTF-16be might have failed (shouldn't!)
         {
-          g = new char[bytes_written + 3];
+          g = (char*)malloc ( sizeof(char) * (bytes_written + 3));
           char const *BOM = "\xFE\xFF";
           strcpy (g, BOM);
           memcpy (&g[2], g_without_BOM, bytes_written + 1); // Copy string + \0
-          free (g_without_BOM);
+          g_free (g_without_BOM);
           bytes_written += 2;
         }
     }