Hello,

Is there any tool or anything that can detect errors related to the usage of not allocated memory?
For example the code could look like this:

...
char* myptr1;
...
char* myptr2="";
...
strcpy(myptr1, "My text");
...
strcpy(myptr2, mystruct.mystring);
...

The main problem is that there are lots of pointers and source files are really huge (tens and hundreds of megabytes). So seeking all the mistakes manually seems like a nightmare, which will take ages. Another problem is that I cannot run the executable program (it requires a specific environment), so I can only compile.

Thanks

Yes there is such a tool. "Valgrind". I'm unsure if it works without running the program you want to test, however.

For static analysis, there is another tool that is very powerful: splint

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.