From: Oliver Kurth Date: Thu, 28 Mar 2019 19:42:59 +0000 (-0700) Subject: Fix a memory leak in vmbackup. X-Git-Tag: stable-11.0.0~164 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=477bc19fac47a71369bf5872c8ff9b366d51ca1a;p=thirdparty%2Fopen-vm-tools.git Fix a memory leak in vmbackup. 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. --- diff --git a/open-vm-tools/services/plugins/vmbackup/stateMachine.c b/open-vm-tools/services/plugins/vmbackup/stateMachine.c index 8647d97c0..6b422869a 100644 --- a/open-vm-tools/services/plugins/vmbackup/stateMachine.c +++ b/open-vm-tools/services/plugins/vmbackup/stateMachine.c @@ -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); diff --git a/open-vm-tools/services/plugins/vmbackup/vmBackupInt.h b/open-vm-tools/services/plugins/vmbackup/vmBackupInt.h index 7fbd3b312..0c9121746 100644 --- a/open-vm-tools/services/plugins/vmbackup/vmBackupInt.h +++ b/open-vm-tools/services/plugins/vmbackup/vmBackupInt.h @@ -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;