summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2012-12-10 21:10:35 -0800
committerYukihiro "Matz" Matsumoto <[email protected]>2012-12-10 21:10:35 -0800
commit31e01daf7a17bdf3dfe46d3a01e3118d293b9d94 (patch)
tree498f909d0d250d2df81cc514859ebd12fcd395c5
parentf51563c610e7194aa4ccfdaf723c359fb812e694 (diff)
parent7befb3e77f6285be7fea8dc55aa85e35bad843b0 (diff)
downloadmruby-31e01daf7a17bdf3dfe46d3a01e3118d293b9d94.tar.gz
mruby-31e01daf7a17bdf3dfe46d3a01e3118d293b9d94.zip
Merge pull request #616 from mattn/fix_generator
fix generator.
-rw-r--r--mrbgems/generator.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/mrbgems/generator.c b/mrbgems/generator.c
index 108405b24..03c51f036 100644
--- a/mrbgems/generator.c
+++ b/mrbgems/generator.c
@@ -28,7 +28,7 @@ static char
static char
*get_full_path(char *path, char *mruby_root)
{
- char full_path[1024] = { 0 };
+ static char full_path[1024] = { 0 };
if (path[0] == '/') {
/* An absolute UNIX path starts with a slash */
strcpy(full_path, path);
@@ -75,7 +75,7 @@ static char
}
}
- ret = malloc(i + count * (newlen - oldlen));
+ ret = malloc(i + count * (newlen - oldlen) + 1);
if (ret == NULL)
exit(EXIT_FAILURE);
@@ -148,7 +148,7 @@ for_each_gem (char before[1024], char after[1024],
char gem_name[1024] = { 0 };
int char_index;
char gem_list[1024][1024] = { { 0 }, { 0 } };
- int gem_index;
+ int gem_index = 0;
int i;
int skip;
FILE *check;
@@ -184,6 +184,8 @@ for_each_gem (char before[1024], char after[1024],
skip = FALSE;
else
skip = TRUE;
+ if (check)
+ fclose(check);
}
if (skip == FALSE)