|
From: Santosh N. <san...@gm...> - 2011-03-29 01:27:39
|
Hi,
The following is the message I get when I run valgrind on my C code.
==16455== Use of uninitialised value of size 8
==16455== at 0x4E6A76B: _itoa_word (_itoa.c:195)
==16455== by 0x4E6B9B8: vfprintf (vfprintf.c:1613)
==16455== by 0x4E75869: printf (printf.c:35)
==16455== by 0x400830: main (matrix1.c:42)
==16455== Uninitialised value was created by a heap allocation
==16455== at 0x4C244E8: malloc (vg_replace_malloc.c:236)
==16455== by 0x400752: main (matrix1.c:28)
>From my understanding something on line 28 in the file matrix1.c is causing
an error. When I look at the source code,
matrix = (int **) malloc (size * sizeof(int *));
for (row = 0; row < size; row++) {
matrix[row] = (int *) malloc (size * sizeof(int));
<------------------- Line 28
}
I do not see how this can be a problem. Am I missing something very
fundamental?
Any suggestion is appreciated.
Thanks
Santosh
|