repositories
/
bf.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
54568c8
)
fix memory bug and free the buffer when finished
author
Mart Lubbers
<mart@martlubbers.net>
Thu, 25 Aug 2016 13:25:24 +0000
(15:25 +0200)
committer
Mart Lubbers
<mart@martlubbers.net>
Thu, 25 Aug 2016 13:25:24 +0000
(15:25 +0200)
bf.c
patch
|
blob
|
history
diff --git
a/bf.c
b/bf.c
index
c095176
..
ef5dd39
100644
(file)
--- a/
bf.c
+++ b/
bf.c
@@
-29,10
+29,11
@@
int main(int argc, char *argv[])
while(1){
switch(fgetc(in)){
case EOF:
+ free(b);
return EXIT_SUCCESS;
case '>':
++ptr;
- if(ptr > b+stacksize){
+ if(ptr >
=
b+stacksize){
offset = ptr-b;
b = realloc(b, stacksize *= 2);
ptr = b+offset;