Re: Valgrind updates

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On Tue, 27 Jan 2009, Johannes Schindelin wrote:
> 
> To help ye Gods, I put together this almost minimal C program:

This one is buggy.

> 	out = fopen("/dev/null", "w");
> 	fwrite(compressed + 51, 51, 1, out);
> 	fwrite(compressed + 51, 1, 1, stderr);
> 	fflush(out);
> 	fclose(out);

The problem is that the first argument to that first "fwrite()" is simply 
wrong. It shouldn't be "compressed + 51", it should be just "compressed". 
As it is, you're writing 51 bytes, starting at 51 bytes in, and that's 
obviously not correct (you only got 58 bytes from deflate()).

So valgrind does complain about it, but for a perfectly valid reason.

So I think your minimal C program isn't actually showing what you wanted 
to show, and isn't showing the behaviour you see in git.

			Linus

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux