git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4978
-
+#include <fcntl.h>
+#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
int main ( void )
{
char* arr = malloc(10);
- (void) write( 1 /* stdout */, arr, 10 );
+ int fd = open("/dev/null", O_WRONLY);
+ if (fd < 0) {
+ fprintf(stderr, "open failed\n");
+ } else {
+ (void)write(fd, arr, 10);
+ (void)close(fd);
+ }
+
return 0;
}
by 0x........: ...
Address 0x........ is 0 bytes inside a block of size 10 alloc'd
at 0x........: malloc (vg_replace_malloc.c:...)
- by 0x........: main (fwrite.c:6)
+ by 0x........: main (fwrite.c:7)
Syscall param write(buf) points to uninitialised byte(s)
at 0x........: write (in /...libc...)
- by 0x........: main (fwrite.c:7)
+ by 0x........: main (fwrite.c:12)
Address 0x........ is 0 bytes inside a block of size 10 alloc'd
at 0x........: malloc (vg_replace_malloc.c:...)
- by 0x........: main (fwrite.c:6)
+ by 0x........: main (fwrite.c:7)