diff options
author | David Robillard <d@drobilla.net> | 2010-02-04 23:53:37 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2010-02-04 23:53:37 +0000 |
commit | 16edd7b1272e91a5ef28e8b9211b8d5721fafe23 (patch) | |
tree | deb678753bb3e74c9f8da1121b7a9c79c13ec753 /src/shared | |
parent | 6f3a80bb9c80b8e0cf486d198c2e107512b2cc46 (diff) | |
download | ingen-16edd7b1272e91a5ef28e8b9211b8d5721fafe23.tar.gz ingen-16edd7b1272e91a5ef28e8b9211b8d5721fafe23.tar.bz2 ingen-16edd7b1272e91a5ef28e8b9211b8d5721fafe23.zip |
Fix a bunch of memory leaks.
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@2429 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/shared')
-rw-r--r-- | src/shared/OSCSender.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
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); } } |