]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
Fix a memory leak in vmbackup.
authorOliver Kurth <okurth@vmware.com>
Thu, 28 Mar 2019 19:42:59 +0000 (12:42 -0700)
committerOliver Kurth <okurth@vmware.com>
Thu, 28 Mar 2019 19:42:59 +0000 (12:42 -0700)
Note: vm_free() is called here because GuestApp_GetConfPath() is calling
Util_SafeStrdup() to allocate the memory.  Both GuestApp_GetConfPath and
vm_free are implemented inside libvmtools.so.

open-vm-tools/services/plugins/vmbackup/stateMachine.c
open-vm-tools/services/plugins/vmbackup/vmBackupInt.h

index 8647d97c0397f0274fe5a8df36f8c8330acb475b..6b422869a7498f2b77aeada8aa730e5bc5c01781 100644 (file)
@@ -359,6 +359,7 @@ VmBackupFinalize(void)
       gBackupState->completer->release(gBackupState->completer);
    }
    g_mutex_clear(&gBackupState->opLock);
+   vm_free(gBackupState->configDir);
    g_free(gBackupState->scriptArg);
    g_free(gBackupState->volumes);
    g_free(gBackupState->snapshots);
@@ -1086,6 +1087,7 @@ error:
    if (gBackupState->completer) {
       gBackupState->completer->release(gBackupState->completer);
    }
+   vm_free(gBackupState->configDir);
    g_free(gBackupState->scriptArg);
    g_free(gBackupState->volumes);
    g_free(gBackupState);
index 7fbd3b312d2cfb75b0359f1db0dd90ad1e2941f0..0c9121746d1f0dc65d2b89a8cc026c9a40ff5287 100644 (file)
@@ -132,7 +132,7 @@ typedef struct VmBackupState {
    guint          timeout;
    gpointer       clientData;
    void          *scripts;
-   const char    *configDir;
+   char          *configDir;
    ssize_t        currentScript;
    gchar         *errorMsg;
    VmBackupMState machineState;