Renegade Public Forums
C&C: Renegade --> Dying since 2003™, resurrected in 2024!
Home » Renegade Discussions » Mod Release Forum » [Plug-in] SSGM2.02 Ping Plugin  () 1 Vote
Re: [Plug-in] SSGM2.02 Ping Plugin [message #439325 is a reply to message #439317] Fri, 12 November 2010 09:25 Go to previous messageGo to previous message
cAmpa is currently offline  cAmpa
Messages: 597
Registered: March 2006
Karma:
Colonel
Jerad Gray wrote on Fri, 12 November 2010 16:53

jnz wrote on Fri, 12 November 2010 05:15

2 mem leaks there.

std::string sender = Get_Player_Name_By_ID(ID);


name = Get_Player_Name(obj);


Appropriate changes would be:

const char *sender_cstr = Get_Player_Name_By_ID(ID);
std::string sender(sender_cstr);
delete []sender_cstr;


const char *name_cstr = Get_Player_Name(obj);
name = std::string(name_cstr); //you don't need to explicitly call the ctor as the assignment operator is overloaded. Just added for clarity.
delete []name_cstr;




Incorrect, you only have to worry about deleting it if you had new char *, otherwise all the * does is auto allocate the size of the array of chars, and is still cleaned up like any normal variable.


Look into Get_Player_Name.


Bückstabü!
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: [skin] Skittles Stealth Effect
Next Topic: [Skins] Duke 3D doors
Goto Forum:
  


Current Time: Wed Aug 21 17:51:35 MST 2024

Total time taken to generate the page: 0.00950 seconds