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;
|
void* dll;
|
||||||
char* name;
|
char* name;
|
||||||
char* nameptr;
|
|
||||||
char* path;
|
char* path;
|
||||||
|
|
||||||
main_entry_t main_entry;
|
main_entry_t main_entry;
|
||||||
|
|
|
@ -210,8 +210,6 @@ vstfx_load (const char *path)
|
||||||
buf = (char *)malloc(strlen(path) + 4); //The .so and a terminating zero
|
buf = (char *)malloc(strlen(path) + 4); //The .so and a terminating zero
|
||||||
|
|
||||||
sprintf (buf, "%s.so", path);
|
sprintf (buf, "%s.so", path);
|
||||||
|
|
||||||
fhandle->nameptr = strdup (path);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -219,8 +217,6 @@ vstfx_load (const char *path)
|
||||||
/*We already have .so appened to the filename*/
|
/*We already have .so appened to the filename*/
|
||||||
|
|
||||||
buf = strdup(path);
|
buf = strdup(path);
|
||||||
|
|
||||||
fhandle->nameptr = strdup (path);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* get a name for the plugin based on the path: ye old VST problem where
|
/* 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
|
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*/
|
/*call load_vstfx_library to actually load the .so into memory*/
|
||||||
|
|
||||||
|
@ -290,9 +286,8 @@ vstfx_unload (VSTHandle* fhandle)
|
||||||
fhandle->dll = 0;
|
fhandle->dll = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fhandle->nameptr)
|
if (fhandle->name)
|
||||||
{
|
{
|
||||||
free (fhandle->nameptr);
|
|
||||||
free (fhandle->name);
|
free (fhandle->name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,6 @@
|
||||||
|
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
static UINT_PTR idle_timer_id = 0;
|
static UINT_PTR idle_timer_id = 0;
|
||||||
//extern char* basename(char *path); //
|
|
||||||
|
|
||||||
#else /* linux + wine */
|
#else /* linux + wine */
|
||||||
|
|
||||||
|
@ -490,9 +489,8 @@ fst_load (const char *path)
|
||||||
if ((strlen(path)) && (NULL != (fhandle = fst_handle_new ())))
|
if ((strlen(path)) && (NULL != (fhandle = fst_handle_new ())))
|
||||||
{
|
{
|
||||||
char* period;
|
char* period;
|
||||||
fhandle->nameptr = strdup (path);
|
|
||||||
fhandle->path = 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, '.'))) {
|
if ((period = strrchr (fhandle->name, '.'))) {
|
||||||
*period = '\0';
|
*period = '\0';
|
||||||
}
|
}
|
||||||
|
@ -541,9 +539,8 @@ fst_unload (VSTHandle** fhandle)
|
||||||
(*fhandle)->path = NULL;
|
(*fhandle)->path = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((*fhandle)->nameptr) {
|
if ((*fhandle)->name) {
|
||||||
free ((*fhandle)->nameptr);
|
free ((*fhandle)->name);
|
||||||
(*fhandle)->nameptr = NULL;
|
|
||||||
(*fhandle)->name = NULL;
|
(*fhandle)->name = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user