From 16edd7b1272e91a5ef28e8b9211b8d5721fafe23 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Thu, 4 Feb 2010 23:53:37 +0000 Subject: Fix a bunch of memory leaks. git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@2429 a436a847-0d15-0410-975c-d299462d15a1 --- src/shared/OSCSender.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src/shared') diff --git a/src/shared/OSCSender.cpp b/src/shared/OSCSender.cpp index 151a3f40..b675265a 100644 --- a/src/shared/OSCSender.cpp +++ b/src/shared/OSCSender.cpp @@ -71,7 +71,7 @@ OSCSender::transfer_end() { assert(_transfer); lo_send_bundle(_address, _transfer); - lo_bundle_free(_transfer); + lo_bundle_free_messages(_transfer); _transfer = NULL; _send_state = Immediate; } @@ -95,6 +95,8 @@ OSCSender::send(const char *path, const char *types, ...) if (!ret) send_message(path, msg); + else + lo_message_free(msg); va_end(args); @@ -109,14 +111,17 @@ OSCSender::send_message(const char* path, lo_message msg) // Don't want to exceed max UDP packet size (good default value?) static const size_t MAX_BUNDLE_SIZE = 1024; - if (!_enabled) + if (!_enabled) { + lo_message_free(msg); return; + } if (_transfer) { if (lo_bundle_length(_transfer) + lo_message_length(msg, path) > MAX_BUNDLE_SIZE) { if (_send_state == SendingBundle) warn << "Maximum bundle size reached, bundle split" << endl; lo_send_bundle(_address, _transfer); + lo_bundle_free_messages(_transfer); lo_timetag t; lo_timetag_now(&t); _transfer = lo_bundle_new(t); @@ -125,6 +130,7 @@ OSCSender::send_message(const char* path, lo_message msg) } else { lo_send_message(_address, path, msg); + lo_message_free(msg); } } -- cgit v1.2.1