fix memory leaks and compiler warnings in LXVST code
authorRobin Gareus <robin@gareus.org>
Thu, 6 Jun 2013 00:24:49 +0000 (02:24 +0200)
committerRobin Gareus <robin@gareus.org>
Thu, 6 Jun 2013 00:24:49 +0000 (02:24 +0200)
libs/ardour/linux_vst_info_file.cc
libs/ardour/linux_vst_support.cc

index 7d4df1dcc8d1dc14731f187b5326c7ba066be7d9..581bcca87fcb1e6423849c6d2def467170e74c6d 100644 (file)
@@ -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);
 }
 
index 99251f08e476234f7969f5d6c7489ad5dc558f2d..1fccf7996825baeadefe35cd1fa9f35a2266c4d0 100644 (file)
@@ -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);
 }