diff options
author | Clyne Sullivan <tullivan99@gmail.com> | 2018-02-22 11:14:53 -0500 |
---|---|---|
committer | Clyne Sullivan <tullivan99@gmail.com> | 2018-02-22 11:14:53 -0500 |
commit | 609ff568843dae9d003153509aaa0080aea7a303 (patch) | |
tree | 1fc99d12f2b123f468a27401bc0259ea454f5b3e /variable.c | |
parent | f414175e0cf08e02d65ca09028641ac2adbd0f8e (diff) |
memory leak fixes, stuff
Diffstat (limited to 'variable.c')
-rw-r--r-- | variable.c | 7 |
1 files changed, 3 insertions, 4 deletions
@@ -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'; |