]> sigrok.org Git - libsigrok.git/commitdiff
session: free memory for datafeed callbacks, reported by valgrind
authorStefan Brüns <redacted>
Thu, 26 Nov 2015 02:04:39 +0000 (03:04 +0100)
committerUwe Hermann <redacted>
Sun, 29 Nov 2015 00:13:58 +0000 (01:13 +0100)
==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)

src/session.c

index 6cf803dd3958f348e3985270707919256f3c209e..4aeddcc2c348c49fd97b3abe791e586efce40b7e 100644 (file)
@@ -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);