|
From: Yoni <ilo...@gm...> - 2009-09-24 12:11:45
|
Hi All, I was trying to run valgrind using exp-ptrcheck, and i keep getting errors on a perfectly good code. I am not a valgrind expert, but I looked a bit on ptrcheck code, and I could not understand how it can work. As I understand, every instruction is classified in the first use, and in the second time ptrcheck will compare the current status to the previews one (in helperc__mem_access). This approach could generate false alarms when you change a pointer legitimately (for example, by passing a pointer to pointer as an argument to a functions). that is what generating the error in my case: the following line generated an error char **p; .... (*p)[len] = 0; and when i changed it to: char **p, *tmp; ... tmp = (*p); tmp[len] = 0; It was OK. I would love if someone could explain to me this approach. Thanks, Yoni. |