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:
parent
15c5d12321
commit
09d5d7f26b
|
@ -62,7 +62,6 @@ struct LIBARDOUR_API _VSTHandle
|
|||
{
|
||||
void* dll;
|
||||
char* name;
|
||||
char* nameptr;
|
||||
char* path;
|
||||
|
||||
main_entry_t main_entry;
|
||||
|
|
|
@ -211,16 +211,12 @@ vstfx_load (const char *path)
|
|||
|
||||
sprintf (buf, "%s.so", path);
|
||||
|
||||
fhandle->nameptr = strdup (path);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
/*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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user