diff options
author | Robin Gareus <robin@gareus.org> | 2014-03-23 00:46:12 +0100 |
---|---|---|
committer | Robin Gareus <robin@gareus.org> | 2014-03-23 00:46:12 +0100 |
commit | 89e63b4bce0fbbbdfe5c2685e929c0f46bbbf7ca (patch) | |
tree | e1be268c907d7855b107f9fb15f816a8651aad9e /libs | |
parent | 167991ecebe30847f76c028bd501f49968271069 (diff) |
fix some memory leaks
Diffstat (limited to 'libs')
-rw-r--r-- | libs/ardour/audio_library.cc | 5 | ||||
-rw-r--r-- | libs/ardour/linux_vst_support.cc | 5 | ||||
-rw-r--r-- | libs/ardour/worker.cc | 2 |
3 files changed, 8 insertions, 4 deletions
diff --git a/libs/ardour/audio_library.cc b/libs/ardour/audio_library.cc index 4a6089dac3..35c0972847 100644 --- a/libs/ardour/audio_library.cc +++ b/libs/ardour/audio_library.cc @@ -105,15 +105,15 @@ AudioLibrary::get_tags (string member) { vector<string> tags; #ifdef HAVE_LRDF + char * uri = strdup(Glib::filename_to_uri(member).c_str()); lrdf_statement pattern; - pattern.subject = strdup(Glib::filename_to_uri(member).c_str()); + pattern.subject = uri; pattern.predicate = const_cast<char*>(TAG); pattern.object = 0; pattern.object_type = lrdf_literal; lrdf_statement* matches = lrdf_matches (&pattern); - free (pattern.subject); lrdf_statement* current = matches; while (current != 0) { @@ -125,6 +125,7 @@ AudioLibrary::get_tags (string member) lrdf_free_statements (matches); sort (tags.begin(), tags.end()); + free (uri); #endif return tags; } 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; diff --git a/libs/ardour/worker.cc b/libs/ardour/worker.cc index b110dc286f..5b416afa46 100644 --- a/libs/ardour/worker.cc +++ b/libs/ardour/worker.cc @@ -124,6 +124,7 @@ Worker::run() while (true) { _sem.wait(); if (_exit) { + if (buf) free(buf); return; } @@ -135,6 +136,7 @@ Worker::run() while (!verify_message_completeness(_requests)) { Glib::usleep(2000); if (_exit) { + if (buf) free(buf); return; } } |