summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--mrbgems/generator.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/mrbgems/generator.c b/mrbgems/generator.c
index 108405b24..76b3ebe1e 100644
--- a/mrbgems/generator.c
+++ b/mrbgems/generator.c
@@ -60,8 +60,9 @@ static char
* String which will be the replacement
*
*/
-static char
-*replace(const char *s, const char *old, const char *new)
+
+static char *
+replace(const char *s, const char *old, const char *new)
{
char *ret;
int i, count = 0;
@@ -75,7 +76,7 @@ static char
}
}
- ret = malloc(i + count * (newlen - oldlen));
+ ret = malloc(i + count * (newlen - oldlen) + 1);
if (ret == NULL)
exit(EXIT_FAILURE);