Hi. some code snippets in my program cause error messages. I think that is wrong. For example:
int main(int argc, char* argv[])
{
char*fname="file.txt";FILE*f=NULL;char*r=NULL;while((f=fopen(fname,"rt"))!=NULL)//(error)Resourceleak:f[resourceLeak]???{/* do something */fclose(f);//if(condition)break;}while((r=(char*)malloc(sizeof(*r)*100))!=NULL)//(error)Memoryleak:r[memleak]???{/* do something */free(r);//if(condition)break;}return0;
}
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi. some code snippets in my program cause error messages. I think that is wrong. For example:
int main(int argc, char* argv[])
{
}
Thanks! I created this ticket https://trac.cppcheck.net/ticket/8854