13
0

remove code intended for use with basename(), fix memory leak since g_path_get_basename() returns a newly allocated string.

This commit is contained in:
Robin Gareus 2014-04-14 15:21:29 +02:00
parent 15c5d12321
commit 09d5d7f26b
3 changed files with 5 additions and 14 deletions

View File

@ -62,7 +62,6 @@ struct LIBARDOUR_API _VSTHandle
{
void* dll;
char* name;
char* nameptr;
char* path;
main_entry_t main_entry;

View File

@ -210,8 +210,6 @@ vstfx_load (const char *path)
buf = (char *)malloc(strlen(path) + 4); //The .so and a terminating zero
sprintf (buf, "%s.so", path);
fhandle->nameptr = strdup (path);
}
else
@ -219,8 +217,6 @@ vstfx_load (const char *path)
/*We already have .so appened to the filename*/
buf = strdup(path);
fhandle->nameptr = strdup (path);
}
/* get a name for the plugin based on the path: ye old VST problem where
@ -228,7 +224,7 @@ vstfx_load (const char *path)
which we don't want to do at this point
*/
fhandle->name = strdup (PBD::basename_nosuffix (fhandle->nameptr).c_str());
fhandle->name = strdup (PBD::basename_nosuffix (path).c_str());
/*call load_vstfx_library to actually load the .so into memory*/
@ -290,9 +286,8 @@ vstfx_unload (VSTHandle* fhandle)
fhandle->dll = 0;
}
if (fhandle->nameptr)
if (fhandle->name)
{
free (fhandle->nameptr);
free (fhandle->name);
}

View File

@ -8,7 +8,6 @@
#include <pthread.h>
static UINT_PTR idle_timer_id = 0;
//extern char* basename(char *path); //
#else /* linux + wine */
@ -490,9 +489,8 @@ fst_load (const char *path)
if ((strlen(path)) && (NULL != (fhandle = fst_handle_new ())))
{
char* period;
fhandle->nameptr = strdup (path);
fhandle->path = strdup (path);
fhandle->name = strdup (g_path_get_basename(fhandle->nameptr));
fhandle->name = g_path_get_basename(path);
if ((period = strrchr (fhandle->name, '.'))) {
*period = '\0';
}
@ -541,9 +539,8 @@ fst_unload (VSTHandle** fhandle)
(*fhandle)->path = NULL;
}
if ((*fhandle)->nameptr) {
free ((*fhandle)->nameptr);
(*fhandle)->nameptr = NULL;
if ((*fhandle)->name) {
free ((*fhandle)->name);
(*fhandle)->name = NULL;
}