From: Jon Burgess Date: Sun, 14 Oct 2018 23:17:09 +0000 (+0100) Subject: Free list returned by sr_session_dev_list() X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=3940abcb470cf34879f278c6ccfc3d3fecd5851d;p=libsigrok.git Free list returned by sr_session_dev_list() ==214948== 16 bytes in 1 blocks are definitely lost in loss record 161 of 6,440 ==214948== at 0x4C2EE0B: malloc (vg_replace_malloc.c:299) ==214948== by 0x650F435: g_malloc (in /usr/lib64/libglib-2.0.so.0.5600.3) ==214948== by 0x6527056: g_slice_alloc (in /usr/lib64/libglib-2.0.so.0.5600.3) ==214948== by 0x65284B0: g_slist_copy_deep (in /usr/lib64/libglib-2.0.so.0.5600.3) ==214948== by 0x592BBA6: sr_session_dev_list (session.c:402) ==214948== by 0x56EF7B5: sigrok::Session::Session(std::shared_ptr, std::__cxx11::basic_string, std::allocator >) (classes.cpp:932) ==214948== 16 bytes in 1 blocks are definitely lost in loss record 162 of 6,440 ==214948== at 0x4C2EE0B: malloc (vg_replace_malloc.c:299) ==214948== by 0x650F435: g_malloc (in /usr/lib64/libglib-2.0.so.0.5600.3) ==214948== by 0x6527056: g_slice_alloc (in /usr/lib64/libglib-2.0.so.0.5600.3) ==214948== by 0x65284B0: g_slist_copy_deep (in /usr/lib64/libglib-2.0.so.0.5600.3) ==214948== by 0x592BBA6: sr_session_dev_list (session.c:402) ==214948== by 0x56F1EB1: sigrok::Session::devices() (classes.cpp:967) --- diff --git a/bindings/cxx/classes.cpp b/bindings/cxx/classes.cpp index 5bc5dc2f..925a557a 100644 --- a/bindings/cxx/classes.cpp +++ b/bindings/cxx/classes.cpp @@ -936,6 +936,7 @@ Session::Session(shared_ptr context, string filename) : _owned_devices.emplace(sdi, move(device)); } _context->_session = this; + g_slist_free(dev_list); } Session::~Session() @@ -970,6 +971,7 @@ vector> Session::devices() auto *const sdi = static_cast(dev->data); result.push_back(get_device(sdi)); } + g_slist_free(dev_list); return result; }