From: Stefan BrĂ¼ns Date: Thu, 26 Nov 2015 02:04:39 +0000 (+0100) Subject: session: free memory for datafeed callbacks, reported by valgrind X-Git-Tag: libsigrok-0.4.0~94 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=877a6d09d54d48814e8cf27a67eab0756136f2ae;p=libsigrok.git session: free memory for datafeed callbacks, reported by valgrind ==17549== 32 (16 direct, 16 indirect) bytes in 1 blocks are definitely lost in loss record 22 of 39 ==17549== at 0x4C29110: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) ==17549== by 0x5359200: g_malloc (in /usr/lib64/libglib-2.0.so.0.4200.2) ==17549== by 0x536EE2D: g_slice_alloc (in /usr/lib64/libglib-2.0.so.0.4200.2) ==17549== by 0x5370165: g_slist_append (in /usr/lib64/libglib-2.0.so.0.4200.2) ==17549== by 0x4E595C3: sr_session_datafeed_callback_add (session.c:512) ==17549== by 0x409527: load_input_file_module (input.c:111) ==17549== by 0x4097AB: load_input_file (input.c:157) ==17549== by 0x40531E: main (main.c:288) --- diff --git a/src/session.c b/src/session.c index 6cf803dd..4aeddcc2 100644 --- a/src/session.c +++ b/src/session.c @@ -256,6 +256,8 @@ SR_API int sr_session_destroy(struct sr_session *session) sr_session_dev_remove_all(session); g_slist_free_full(session->owned_devs, (GDestroyNotify)sr_dev_inst_free); + sr_session_datafeed_callback_remove_all(session); + g_hash_table_unref(session->event_sources); g_mutex_clear(&session->main_mutex);