On Fri, Jun 17, 2011 at 5:45 PM, Stephanie Stroka
<stephanie.str...@salzburgresearch.at> wrote:
>
> My code at that position looks like this:
>
> 284 static uint* sort(uint** matrix, uint width, uint height) {
> 285     uint* data = (uint*) malloc(width * height * sizeof(uint));
> 286     uint i,j=0;
> 287     for(i=0; i<height; i++) {
> 288         for(j=0; j<width; j++) {
> 289             data[j + i*height] = matrix[i][j];
> 290         }
> 291     }

The above won't crash if height is less than or equal to width, but if
height is larger than width it will crash. Haven't you noticed yet
what is wrong with the above code ?

Bart.

------------------------------------------------------------------------------
EditLive Enterprise is the world's most technically advanced content
authoring tool. Experience the power of Track Changes, Inline Image
Editing and ensure content is compliant with Accessibility Checking.
http://p.sf.net/sfu/ephox-dev2dev
_______________________________________________
Valgrind-users mailing list
Valgrind-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/valgrind-users

Reply via email to