嗨,我有这个问题:
tmpy = (int**)realloc(os,y*sizeof(int*));
os = tmpy;
tmpy=NULL;
for(i=0;i<y;i++) {
tmpx = (int*)realloc(os[i],x*sizeof(int));
os[i] = tmpx;
tmpx=NULL;
}
程序运行良好,但 valgrind 给出此错误:
==12513== Conditional jump or move depends on uninitialised value(s)
==12513== at 0x402BF0D: realloc (in /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so)
==12513== by 0x8048760: main (main.c:55)
==12513== Uninitialised value was created by a heap allocation
==12513== at 0x402BF52: realloc (in /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so)
==12513== by 0x804871E: main (main.c:50)
==12513==
怎么了?感谢您的帮助。