]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
Reduce the scope of a local variable.
authorJohn Wolfe <jwolfe@vmware.com>
Thu, 12 Aug 2021 19:46:05 +0000 (12:46 -0700)
committerJohn Wolfe <jwolfe@vmware.com>
Thu, 12 Aug 2021 19:46:05 +0000 (12:46 -0700)
The 'Codacy' tool reported that the scope of a local variable can be
reduced in the Debug() function of linuxDeployment.c.

open-vm-tools/libDeployPkg/linuxDeployment.c

index 2cf77e61c21613c05db3b0189f86222a49f1255e..91f958c9f8afc8cdc26738f69b2b62da71e90924 100644 (file)
@@ -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);