Click here to Skip to main content
15,914,010 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: diamond problem and virtual inheritance Pin
SandipG 22-Sep-08 21:07
SandipG 22-Sep-08 21:07 
GeneralRe: diamond problem and virtual inheritance Pin
George_George22-Sep-08 21:26
George_George22-Sep-08 21:26 
GeneralRe: diamond problem and virtual inheritance Pin
SandipG 22-Sep-08 21:30
SandipG 22-Sep-08 21:30 
GeneralRe: diamond problem and virtual inheritance Pin
George_George22-Sep-08 21:34
George_George22-Sep-08 21:34 
GeneralRe: diamond problem and virtual inheritance Pin
SandipG 22-Sep-08 21:37
SandipG 22-Sep-08 21:37 
GeneralRe: diamond problem and virtual inheritance Pin
George_George22-Sep-08 21:39
George_George22-Sep-08 21:39 
QuestionRe: diamond problem and virtual inheritance Pin
laksh220422-Sep-08 23:03
laksh220422-Sep-08 23:03 
QuestionIs there any memory leak in this code? Pin
SRKSHOME22-Sep-08 19:33
SRKSHOME22-Sep-08 19:33 
Hi,
Is there any memory leak in the following code? I cannot see any one. But bound checker telling there is a leak? Please advice me. Thanks in advance.
class test<br />
{<br />
	char* m_name;<br />
public:<br />
	test():m_name(NULL)<br />
	{}<br />
	void Set(const char* name)<br />
	{<br />
		<br />
		if(name!=NULL && strlen(name))<br />
		{<br />
			m_name = new char[strlen(name)+1];<br />
			strcpy(m_name,name);<br />
		}<br />
		else<br />
			delete [] m_name;<br />
	}<br />
	~test()<br />
	{<br />
		Set(NULL);<br />
	}<br />
	void display()<br />
	{<br />
		cout<<m_name<<endl;<br />
	}<br />
};<br />
int main(int argc, char* argv[])<br />
{       test tst;<br />
	tst.Set("123456");<br />
	tst.display();	<br />
	return 0;<br />
}<br />

AnswerRe: Is there any memory leak in this code? Pin
User 21559722-Sep-08 19:53
User 21559722-Sep-08 19:53 
GeneralRe: Is there any memory leak in this code? Pin
SRKSHOME22-Sep-08 20:49
SRKSHOME22-Sep-08 20:49 
GeneralRe: Is there any memory leak in this code? Pin
User 21559722-Sep-08 21:46
User 21559722-Sep-08 21:46 
AnswerRe: Is there any memory leak in this code? Pin
Sarath C22-Sep-08 20:46
Sarath C22-Sep-08 20:46 
GeneralRe: Is there any memory leak in this code? Pin
SRKSHOME22-Sep-08 20:53
SRKSHOME22-Sep-08 20:53 
Questionproblem in copy .exe file Pin
vcprog22-Sep-08 18:56
vcprog22-Sep-08 18:56 
AnswerRe: problem in copy .exe file Pin
_AnsHUMAN_ 22-Sep-08 19:01
_AnsHUMAN_ 22-Sep-08 19:01 
GeneralRe: problem in copy .exe file Pin
vcprog22-Sep-08 19:22
vcprog22-Sep-08 19:22 
AnswerRe: problem in copy .exe file Pin
Hamid_RT22-Sep-08 19:34
Hamid_RT22-Sep-08 19:34 
GeneralRe: problem in copy .exe file Pin
vcprog22-Sep-08 19:38
vcprog22-Sep-08 19:38 
GeneralRe: problem in copy .exe file Pin
Mahesh Kulkarni22-Sep-08 19:49
Mahesh Kulkarni22-Sep-08 19:49 
GeneralRe: problem in copy .exe file Pin
Hamid_RT22-Sep-08 19:50
Hamid_RT22-Sep-08 19:50 
QuestionRe: problem in copy .exe file Pin
Rajesh R Subramanian22-Sep-08 19:44
professionalRajesh R Subramanian22-Sep-08 19:44 
AnswerRe: problem in copy .exe file Pin
vcprog22-Sep-08 19:47
vcprog22-Sep-08 19:47 
GeneralRe: problem in copy .exe file Pin
Rajesh R Subramanian22-Sep-08 19:56
professionalRajesh R Subramanian22-Sep-08 19:56 
GeneralRe: problem in copy .exe file Pin
vcprog22-Sep-08 20:19
vcprog22-Sep-08 20:19 
GeneralRe: problem in copy .exe file Pin
Hamid_RT22-Sep-08 20:43
Hamid_RT22-Sep-08 20:43 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.