Hello!
I discovered valgrind and started using it for my c code. But I get following error message at almost every malloc position, :
==19505== 40 errors in context 10 of 12:
==19505== Use of uninitialised value of size 8
==19505== at 0x10000416E: my_method (main.c:662)
==19505== by 0x10000159E: main (main.c:182)
==19505== Uninitialised value was created by a heap allocation
==19505== at 0x47F1: malloc (vg_replace_malloc.c:302)
==19505== by 0x100001C21: my_method (main.c:333)
==19505== by 0x10000159E: main (main.c:182)
and I really don't understand what it means. I already googled it but I didn't find out what is my mistake.
SO here i just put one example:
Code:
int main(int argc, char** argv) {
//i declare my variables at this position
Uint *used, *forbidden_jumps, *forbidden_jumpsV,
*forbidden_jump;
/*now i want to allocate one of them, this is my line 333 from the error message*/
//a_num is set during the execution of the program,
ALLOC(used, Uint, a_num);
}
// i defined a macro alloc which looks like this
Code:
#define ALLOC(P,T,S) if(((P)=(T*)malloc(sizeof(T)*(S))) == NULL) {\
fprintf(stderr,"malloc failed");\
exit(1);\
}
Is there any help page for the output of valgrind? I found it on the homepage but it is not so well-explained for my taste