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 #439317 is a reply to message #439301] Fri, 12 November 2010 08:53 Go to previous messageGo to previous message
Jerad2142 is currently offline  Jerad2142
Messages: 3806
Registered: July 2006
Location: USA
Karma:
General (3 Stars)
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.


 
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:46:03 MST 2024

Total time taken to generate the page: 0.00944 seconds