|
From: shuLhan <m.s...@gm...> - 2009-02-16 05:53:56
|
On Monday 16 February 2009 12:08:05 Nandini Chandra (nandchan) wrote:
> Sample program:
> ---------------------------------------
> #include <stdlib.h>
>
> void foo(void)
> {
> int* x = malloc(10 * sizeof(int));
>
> x[10] = 0; // problem 1: heap block overrun
> } // problem 2: memory leak -- x not freed
>
This is a very basic C language error. 'x' only have index 0..9, not 10.
--
~ shuLhan ~
|