fix some memory leaks

This commit is contained in:
Robin Gareus
2014-03-23 00:46:12 +01:00
parent 167991eceb
commit 89e63b4bce
5 changed files with 10 additions and 5 deletions

View File

@@ -374,6 +374,7 @@ AnalysisWindow::analyze_data (Gtk::Button * /*button*/)
free(buf); free(buf);
free(mixbuf); free(mixbuf);
free(gain);
track_list_ready = true; track_list_ready = true;
} /* end lock */ } /* end lock */

View File

@@ -716,7 +716,7 @@ void
VideoTimeLine::find_xjadeo () { VideoTimeLine::find_xjadeo () {
std::string xjadeo_file_path; std::string xjadeo_file_path;
if (getenv("XJREMOTE")) { if (getenv("XJREMOTE")) {
_xjadeo_bin = strdup(getenv("XJREMOTE")); // XXX TODO: free it?! _xjadeo_bin = getenv("XJREMOTE");
} else if (find_file_in_search_path (Searchpath(Glib::getenv("PATH")), X_("xjremote"), xjadeo_file_path)) { } else if (find_file_in_search_path (Searchpath(Glib::getenv("PATH")), X_("xjremote"), xjadeo_file_path)) {
_xjadeo_bin = xjadeo_file_path; _xjadeo_bin = xjadeo_file_path;
} }

View File

@@ -105,15 +105,15 @@ AudioLibrary::get_tags (string member)
{ {
vector<string> tags; vector<string> tags;
#ifdef HAVE_LRDF #ifdef HAVE_LRDF
char * uri = strdup(Glib::filename_to_uri(member).c_str());
lrdf_statement pattern; lrdf_statement pattern;
pattern.subject = strdup(Glib::filename_to_uri(member).c_str()); pattern.subject = uri;
pattern.predicate = const_cast<char*>(TAG); pattern.predicate = const_cast<char*>(TAG);
pattern.object = 0; pattern.object = 0;
pattern.object_type = lrdf_literal; pattern.object_type = lrdf_literal;
lrdf_statement* matches = lrdf_matches (&pattern); lrdf_statement* matches = lrdf_matches (&pattern);
free (pattern.subject);
lrdf_statement* current = matches; lrdf_statement* current = matches;
while (current != 0) { while (current != 0) {
@@ -125,6 +125,7 @@ AudioLibrary::get_tags (string member)
lrdf_free_statements (matches); lrdf_free_statements (matches);
sort (tags.begin(), tags.end()); sort (tags.begin(), tags.end());
free (uri);
#endif #endif
return tags; return tags;
} }

View File

@@ -112,7 +112,7 @@ vstfx_new ()
void* vstfx_load_vst_library(const char* path) void* vstfx_load_vst_library(const char* path)
{ {
void* dll; void* dll;
char* full_path; char* full_path = NULL;
char* envdup; char* envdup;
char* lxvst_path; char* lxvst_path;
size_t len1; size_t len1;
@@ -160,6 +160,7 @@ void* vstfx_load_vst_library(const char* path)
vstfx_error ("\"%s\"", lxvst_path); vstfx_error ("\"%s\"", lxvst_path);
len1 = strlen(lxvst_path); len1 = strlen(lxvst_path);
if (full_path) free(full_path);
full_path = (char*)malloc(len1 + 1 + len2 + 1); full_path = (char*)malloc(len1 + 1 + len2 + 1);
memcpy(full_path, lxvst_path, len1); memcpy(full_path, lxvst_path, len1);
full_path[len1] = '/'; full_path[len1] = '/';
@@ -180,7 +181,7 @@ void* vstfx_load_vst_library(const char* path)
} }
/*Free the path*/ /*Free the path*/
if (full_path) free(full_path);
free(envdup); free(envdup);
return dll; return dll;

View File

@@ -124,6 +124,7 @@ Worker::run()
while (true) { while (true) {
_sem.wait(); _sem.wait();
if (_exit) { if (_exit) {
if (buf) free(buf);
return; return;
} }
@@ -135,6 +136,7 @@ Worker::run()
while (!verify_message_completeness(_requests)) { while (!verify_message_completeness(_requests)) {
Glib::usleep(2000); Glib::usleep(2000);
if (_exit) { if (_exit) {
if (buf) free(buf);
return; return;
} }
} }