repo.or.cz
/
valgrind.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
memcheck: Handle Err_ReallocSizeZero in MC_(eq_Error)
[valgrind.git]
/
memcheck
/
tests
/
brk2.c
blob
3a881335e43e3ceff1563cba870b6e56a1e4caf6
1
#include <stdio.h>
2
#include <unistd.h>
3
4
#define MAX 3000
5
6
// At one time, this was causing a seg fault within Valgrind -- it was when
7
// extending the brk segment onto a new page. Fixed in vg_syscalls.c 1.129.
8
9
int
main
() {
10
char
*
ptr
;
11
int
i
;
12
13
for
(
i
=
0
;
i
<
MAX
;
i
++) {
14
ptr
=
sbrk
(
1
);
15
16
if
(
ptr
== (
void
*)-
1
) {
17
printf
(
"sbrk() failed!
\n
"
);
18
return
0
;
19
}
20
21
*
ptr
=
0
;
22
}
23
24
return
0
;
25
}