From: John Wolfe Date: Thu, 12 Aug 2021 19:46:05 +0000 (-0700) Subject: Reduce the scope of a local variable. X-Git-Tag: stable-12.0.0~126 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f254eef58523fc9539e3836d825056b999ff192b;p=thirdparty%2Fopen-vm-tools.git Reduce the scope of a local variable. The 'Codacy' tool reported that the scope of a local variable can be reduced in the Debug() function of linuxDeployment.c. --- diff --git a/open-vm-tools/libDeployPkg/linuxDeployment.c b/open-vm-tools/libDeployPkg/linuxDeployment.c index 2cf77e61c..91f958c9f 100644 --- a/open-vm-tools/libDeployPkg/linuxDeployment.c +++ b/open-vm-tools/libDeployPkg/linuxDeployment.c @@ -273,11 +273,10 @@ void Debug(const char *fmtstr, ...) { #ifdef VMX86_DEBUG - va_list args; - char *tmp = malloc(MAXSTRING); if (tmp != NULL) { + va_list args; va_start(args, fmtstr); Str_Vsnprintf(tmp, MAXSTRING, fmtstr, args); va_end(args); @@ -465,11 +464,10 @@ SetDeployError(const char* format, ...) /* * No Error check is employed since this is only an advisory service. */ - va_list args; - char* tmp = malloc(MAXSTRING); if (tmp != NULL) { + va_list args; va_start(args, format); Str_Vsnprintf(tmp, MAXSTRING, format, args); va_end(args);