aboutsummaryrefslogtreecommitdiffstats
path: root/variable.c
diff options
context:
space:
mode:
authorClyne Sullivan <tullivan99@gmail.com>2018-02-22 11:14:53 -0500
committerClyne Sullivan <tullivan99@gmail.com>2018-02-22 11:14:53 -0500
commit609ff568843dae9d003153509aaa0080aea7a303 (patch)
tree1fc99d12f2b123f468a27401bc0259ea454f5b3e /variable.c
parentf414175e0cf08e02d65ca09028641ac2adbd0f8e (diff)
memory leak fixes, stuff
Diffstat (limited to 'variable.c')
-rw-r--r--variable.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/variable.c b/variable.c
index 38b771b..bcf96cb 100644
--- a/variable.c
+++ b/variable.c
@@ -12,10 +12,9 @@ extern char *str_func;
char *fixstring(char *s)
{
- int len = strlen(s);
- char *n = malloc(len + 1);
- int i, j;
- for (i = 0, j = 0; s[i] != '\0'; i++, j++) {
+ char *n = malloc(strlen(s) + 1);
+ int j = 0;
+ for (int i = 0; s[i] != '\0'; i++, j++) {
if (s[i] == '\\') {
if (s[i + 1] == 'n')
n[j] = '\n';