diff --git a/example-mods/chat-commands/chat-commands.cpp b/example-mods/chat-commands/chat-commands.cpp index 30350521be..3791c39fa0 100644 --- a/example-mods/chat-commands/chat-commands.cpp +++ b/example-mods/chat-commands/chat-commands.cpp @@ -17,9 +17,8 @@ HOOK(chat_handle_packet_send, void, (const Minecraft *minecraft, ChatPacket *pac if (out.length() > 0 && out[out.length() - 1] == '\n') { out[out.length() - 1] = '\0'; } - char *cp437_out = to_cp437(out.c_str()); + std::string cp437_out = to_cp437(out); gui->addMessage(cp437_out); - free(cp437_out); } else { // Call Original Method real_chat_handle_packet_send()(minecraft, packet);