From 89e63b4bce0fbbbdfe5c2685e929c0f46bbbf7ca Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Sun, 23 Mar 2014 00:46:12 +0100 Subject: fix some memory leaks --- libs/ardour/linux_vst_support.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'libs/ardour/linux_vst_support.cc') diff --git a/libs/ardour/linux_vst_support.cc b/libs/ardour/linux_vst_support.cc index 9d36905f48..f34112e24b 100644 --- a/libs/ardour/linux_vst_support.cc +++ b/libs/ardour/linux_vst_support.cc @@ -112,7 +112,7 @@ vstfx_new () void* vstfx_load_vst_library(const char* path) { void* dll; - char* full_path; + char* full_path = NULL; char* envdup; char* lxvst_path; size_t len1; @@ -160,6 +160,7 @@ void* vstfx_load_vst_library(const char* path) vstfx_error ("\"%s\"", lxvst_path); len1 = strlen(lxvst_path); + if (full_path) free(full_path); full_path = (char*)malloc(len1 + 1 + len2 + 1); memcpy(full_path, lxvst_path, len1); full_path[len1] = '/'; @@ -180,7 +181,7 @@ void* vstfx_load_vst_library(const char* path) } /*Free the path*/ - + if (full_path) free(full_path); free(envdup); return dll; -- cgit v1.2.3