13
0

fix memory leaks and compiler warnings in LXVST code

This commit is contained in:
Robin Gareus 2013-06-06 02:24:49 +02:00
parent cd8180c864
commit e9341a7de3
2 changed files with 10 additions and 4 deletions

View File

@ -169,7 +169,7 @@ vstfx_infofile_path (char* dllpath, int personal)
} }
} else { } else {
dir = Glib::path_get_dirname (dllpath); dir = Glib::path_get_dirname (std::string(dllpath));
} }
stringstream s; stringstream s;
@ -214,6 +214,7 @@ vstfx_infofile_for_read (char* dllpath)
{ {
struct stat own_statbuf; struct stat own_statbuf;
struct stat sys_statbuf; struct stat sys_statbuf;
FILE *rv = NULL;
char* own_info = vstfx_infofile_stat (dllpath, &own_statbuf, 1); char* own_info = vstfx_infofile_stat (dllpath, &own_statbuf, 1);
char* sys_info = vstfx_infofile_stat (dllpath, &sys_statbuf, 0); char* sys_info = vstfx_infofile_stat (dllpath, &sys_statbuf, 0);
@ -222,14 +223,16 @@ vstfx_infofile_for_read (char* dllpath)
if (sys_info) { if (sys_info) {
if (own_statbuf.st_mtime <= sys_statbuf.st_mtime) { if (own_statbuf.st_mtime <= sys_statbuf.st_mtime) {
/* system info file is newer, use it */ /* system info file is newer, use it */
return g_fopen (sys_info, "rb"); rv = g_fopen (sys_info, "rb");
} }
} else { } 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 * static FILE *
@ -416,6 +419,8 @@ vstfx_free_info (VSTInfo *info)
free (info->name); free (info->name);
free (info->creator); free (info->creator);
free (info->Category); free (info->Category);
free (info->ParamNames);
free (info->ParamLabels);
free (info); free (info);
} }

View File

@ -379,6 +379,7 @@ void vstfx_close (VSTState* vstfx)
dlclose(vstfx->handle->dll); //dlclose keeps its own reference count dlclose(vstfx->handle->dll); //dlclose keeps its own reference count
vstfx->handle->dll = 0; vstfx->handle->dll = 0;
} }
free(vstfx);
} }