diff --git a/libraries/AP_Scripting/generator/src/main.c b/libraries/AP_Scripting/generator/src/main.c index 0b1b1e76f7..450a0ef148 100644 --- a/libraries/AP_Scripting/generator/src/main.c +++ b/libraries/AP_Scripting/generator/src/main.c @@ -171,6 +171,8 @@ void trace(const int trace, const char *message, ...) { va_start(args, message); vfprintf(stderr, fmt, args); va_end(args); + free(fmt); + fmt = NULL; } } @@ -191,7 +193,8 @@ void error(const int code, const char *message, ...) { va_start(args, message); vfprintf(stderr, fmt, args); va_end(args); - + free(fmt); + fmt = NULL; exit(code); }