[Bug] Memory leak in CCLabelBMFont::setString (

[Bug] Memory leak in CCLabelBMFont::setString (
0.0 0



I have found a memory leak when calling the CCLabelBMFont::setString functions. I tracked it down to the call to:


in this function:

    static unsigned short* cc_utf8_from_cstr(const char* str_old)
        int len = cc_utf8_strlen(str_old, -1);

        unsigned short* str_new = new unsigned short[len + 1];   // <<<<< MEMORY LEAK
        str_new[len] = 0;

        for (int i = 0; i < len; ++i)
            str_new[i] = cc_utf8_get_char(str_old);
            str_old = cc_utf8_next_char(str_old);

        return str_new;

This can be a significant leak if setString is called in the game update loop. (this occurs both for when setString update parameter is set to true or false).