From: Reinhold Kainhofer Date: Tue, 23 Aug 2011 15:24:10 +0000 (+0200) Subject: pdf-scheme: use malloc and g_free to avoid mixing new/free in scm_take_str X-Git-Tag: release/2.15.9-1~9^2~7 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=df9ba47e88bd0307696ed7ef2b6f862589885550;p=lilypond.git pdf-scheme: use malloc and g_free to avoid mixing new/free in scm_take_str --- diff --git a/lily/pdf-scheme.cc b/lily/pdf-scheme.cc index ecfe5c4f01..13e8389ece 100644 --- a/lily/pdf-scheme.cc +++ b/lily/pdf-scheme.cc @@ -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; } }