repo.or.cz
/
lcapit-junk-code.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
web: home-page: Add new page
[lcapit-junk-code.git]
/
leak.c
blob
db71c6fe2e4744c95d5d4f619a2c14586a6a37b8
1
/*
2
* Leaks memory in SIZE chunks
3
*/
4
#include <stdio.h>
5
#include <string.h>
6
#include <stdlib.h>
7
8
#define SIZE (1024 * 1024)
9
10
int
main
(
void
)
11
{
12
char
*
p
;
13
14
for
(;;) {
15
p
=
malloc
(
SIZE
);
16
if
(!
p
) {
17
perror
(
"malloc()"
);
18
exit
(
1
);
19
}
20
memset
(
p
,
0
,
SIZE
);
21
}
22
23
return
0
;
24
}