openMSX / wxcatapult

23 stars 4 forks source link

[Bug] wxCatapult: investigate where the memory gets freed [sf#492] #25

Closed openMSX-import closed 9 years ago

openMSX-import commented 9 years ago

Reported by joxy on 2013-08-05 09:07 UTC openMSXController.cpp: openMSXController::WriteCommand(wxString msg, TargetType target)

#if !defined(__WXMSW__)
#define CA_ALLOC(a) alloca(a)
#else
#define CA_ALLOC(a) malloc(a)
#endif
    char* cmd = static_cast<char*>(CA_ALLOC(len2));
    memcpy(cmd, "<command>", 9);
    memcpy(cmd + 9, buffer, len);
    memcpy(cmd + 9 + len, "</command>\n", 11);
    WriteMessage((xmlChar*)cmd, len2);

    xmlFree(buffer);
}
openMSX-import commented 9 years ago

Updated by joxy on 2013-08-11 20:52 UTC

openMSX-import commented 9 years ago

Commented by manuelbi on 2013-08-12 19:21 UTC Um, so what is the outcome of the investigation?

openMSX-import commented 9 years ago

Commented by m9710797 on 2013-08-12 19:42 UTC This bug report was invalid: alloca()'ed doesn't need to be free()'ed. The only problem was that alloca() doesn't exist in visual studio. See commit ef118b3f.

openMSX-import commented 9 years ago

Commented by joxy on 2013-08-12 19:51 UTC I introduced this bug when I introduced malloc(). This bug was fixed by reverting my commit with malloc().