Click here to Skip to main content
15,926,062 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRemote-Access to another PC Pin
Harald Diel12-Jan-03 22:13
Harald Diel12-Jan-03 22:13 
GeneralRe: Remote-Access to another PC Pin
benjymous12-Jan-03 23:41
benjymous12-Jan-03 23:41 
Generalwarning and memory leak! Pin
r i s h a b h s12-Jan-03 20:29
r i s h a b h s12-Jan-03 20:29 
GeneralRe: warning and memory leak! Pin
Joaquín M López Muñoz12-Jan-03 21:23
Joaquín M López Muñoz12-Jan-03 21:23 
GeneralRe: warning and memory leak! Pin
r i s h a b h s12-Jan-03 21:43
r i s h a b h s12-Jan-03 21:43 
GeneralRe: warning and memory leak! Pin
Joaquín M López Muñoz12-Jan-03 21:50
Joaquín M López Muñoz12-Jan-03 21:50 
GeneralRe: warning and memory leak! Pin
r i s h a b h s12-Jan-03 21:58
r i s h a b h s12-Jan-03 21:58 
Generalcan any one help me with the memory leak Pin
r i s h a b h s12-Jan-03 23:16
r i s h a b h s12-Jan-03 23:16 
dear all,
the code (in Bold) generates a memory leak and i get a warning, Object dump complete

char *CConfig::InputFilePath ()
{
char *inp;
inp = new char[MAXCHARS]; /*??Memory Leak, but it is deleted later in the code */
int i= GetPrivateProfileString("Paths", "inputfile", "" ,inp, MAXCHARS, IniPath);
CString path(inp);
char filename[11];
int ch = 92;
unsigned int result;
char *pdest;
char iPath[MAXCHARS];
try
{
if ( (path == "") || CConfig::DoesDirectoryExist (inp) == false )
{
path = "";
strcpy(iPath,"");
return iPath;
}
pdest = strrchr( path, ch );
result = pdest - path + 1;
if ( result == strlen(path) )
{
strcpy(filename,"Input.con");
}
else
{
strcpy(filename,"\\Input.con");
}
strcpy(inp,path);
strcpy(inp, strncat( inp, filename,strlen(filename)));
}
catch(...)
{
path = "";
strcpy(iPath,"");
return iPath;
}
strcpy(iPath,inp);
delete [] inp;
return iPath;
}




can someone tell me why this leak is occurring and how to prevent it!
Confused | :confused:

thanx
GeneralRe: can any one help me with the memory leak Pin
Alvaro Mendez13-Jan-03 4:34
Alvaro Mendez13-Jan-03 4:34 
GeneralRe: can any one help me with the memory leak Pin
Daniel Turini13-Jan-03 4:53
Daniel Turini13-Jan-03 4:53 
GeneralRe: can any one help me with the memory leak Pin
Tim Smith13-Jan-03 6:45
Tim Smith13-Jan-03 6:45 
GeneralGraphics Pin
chepuri_uk12-Jan-03 19:53
chepuri_uk12-Jan-03 19:53 
GeneralRe: Graphics Pin
includeh1013-Jan-03 0:06
includeh1013-Jan-03 0:06 
GeneralDiscovering DLLs Functions and Parameters Pin
Huttami12-Jan-03 19:34
Huttami12-Jan-03 19:34 
GeneralRe: Discovering DLLs Functions and Parameters Pin
includeh1013-Jan-03 0:15
includeh1013-Jan-03 0:15 
GeneralRe: Discovering DLLs Functions and Parameters Pin
Martyn Pearson13-Jan-03 3:19
Martyn Pearson13-Jan-03 3:19 
GeneralRe: Discovering DLLs Functions and Parameters Pin
Anonymous14-Jan-03 3:46
Anonymous14-Jan-03 3:46 
GeneralRe: Re Discovering DLLs Functions and Parameters Pin
Anonymous14-Jan-03 3:55
Anonymous14-Jan-03 3:55 
QuestionAny ideas? Pin
Joshua Nussbaum12-Jan-03 19:21
Joshua Nussbaum12-Jan-03 19:21 
AnswerRe: Any ideas? Pin
Moak12-Jan-03 19:37
Moak12-Jan-03 19:37 
AnswerRe: Any ideas? Pin
Nitron13-Jan-03 3:38
Nitron13-Jan-03 3:38 
GeneralWants to develop Intrusion Detection System(IDS) Pin
summo12-Jan-03 19:05
summo12-Jan-03 19:05 
GeneralRe: Wants to develop Intrusion Detection System(IDS) Pin
geo_m13-Jan-03 0:21
geo_m13-Jan-03 0:21 
GeneralRe: Wants to develop Intrusion Detection System(IDS) Pin
Dana Epp15-Jan-03 9:09
Dana Epp15-Jan-03 9:09 
GeneralTemporal position of pMainFrame->LoadFrame & DialogBar Control Updates... Pin
JennyP12-Jan-03 18:52
JennyP12-Jan-03 18:52 

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.