diff --git a/misc.c b/misc.c index b431a67..e2620fa 100644 --- a/misc.c +++ b/misc.c @@ -171,7 +171,6 @@ char * escape_string(const char *input) { char *out = strdup(input); - int len = strlen(out); const char *esc = "\'\"\\ "; if (!out) @@ -180,6 +179,8 @@ escape_string(const char *input) return NULL; } + int len = strlen(out); + for (int pos = 0; pos < len; ++pos) { if (strchr(esc, out[pos]))