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 ~

------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
Valgrind-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/valgrind-users

Reply via email to