From e9341a7de38a7edd7c70aedd17a53e8d91b293a1 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Thu, 6 Jun 2013 02:24:49 +0200 Subject: [PATCH] fix memory leaks and compiler warnings in LXVST code --- libs/ardour/linux_vst_info_file.cc | 13 +++++++++---- libs/ardour/linux_vst_support.cc | 1 + 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/libs/ardour/linux_vst_info_file.cc b/libs/ardour/linux_vst_info_file.cc index 7d4df1dcc8..581bcca87f 100644 --- a/libs/ardour/linux_vst_info_file.cc +++ b/libs/ardour/linux_vst_info_file.cc @@ -169,7 +169,7 @@ vstfx_infofile_path (char* dllpath, int personal) } } else { - dir = Glib::path_get_dirname (dllpath); + dir = Glib::path_get_dirname (std::string(dllpath)); } stringstream s; @@ -214,6 +214,7 @@ vstfx_infofile_for_read (char* dllpath) { struct stat own_statbuf; struct stat sys_statbuf; + FILE *rv = NULL; char* own_info = vstfx_infofile_stat (dllpath, &own_statbuf, 1); char* sys_info = vstfx_infofile_stat (dllpath, &sys_statbuf, 0); @@ -222,14 +223,16 @@ vstfx_infofile_for_read (char* dllpath) if (sys_info) { if (own_statbuf.st_mtime <= sys_statbuf.st_mtime) { /* system info file is newer, use it */ - return g_fopen (sys_info, "rb"); + rv = g_fopen (sys_info, "rb"); } } else { - return g_fopen (own_info, "rb"); + rv = g_fopen (own_info, "rb"); } } + free(own_info); + free(sys_info); - return 0; + return rv; } static FILE * @@ -416,6 +419,8 @@ vstfx_free_info (VSTInfo *info) free (info->name); free (info->creator); free (info->Category); + free (info->ParamNames); + free (info->ParamLabels); free (info); } diff --git a/libs/ardour/linux_vst_support.cc b/libs/ardour/linux_vst_support.cc index 99251f08e4..1fccf79968 100644 --- a/libs/ardour/linux_vst_support.cc +++ b/libs/ardour/linux_vst_support.cc @@ -379,6 +379,7 @@ void vstfx_close (VSTState* vstfx) dlclose(vstfx->handle->dll); //dlclose keeps its own reference count vstfx->handle->dll = 0; } + free(vstfx); } -- 2.30.2