mirror of
https://github.com/Zenithsiz/ftmemsim-valgrind.git
synced 2026-02-03 01:51:29 +00:00
Fixed test to not assume that malloc(10) will return 10 nul bytes!
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4978
This commit is contained in:
parent
00774ab311
commit
030b1aac10
@ -1,9 +1,17 @@
|
||||
|
||||
#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;
|
||||
}
|
||||
|
||||
@ -4,4 +4,4 @@ Syscall param write(buf) points to uninitialised byte(s)
|
||||
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)
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
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)
|
||||
|
||||
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user