diff options
author | Jon Burgess <jburgess777@gmail.com> | 2018-10-14 19:10:16 +0100 |
---|---|---|
committer | Uwe Hermann <uwe@hermann-uwe.de> | 2018-10-21 16:39:33 +0200 |
commit | 9a9f5a7a52d47a6e41048d943a2ab7e54e0948ce (patch) | |
tree | fdfdac83fb32dd0234600bffd002fc511857fd81 | |
parent | 07560450ad9427b01b99f4b3b10483e7fdf3926f (diff) | |
download | libsigrokdecode-9a9f5a7a52d47a6e41048d943a2ab7e54e0948ce.tar.gz libsigrokdecode-9a9f5a7a52d47a6e41048d943a2ab7e54e0948ce.zip |
Fix memory leak in decoder test code
==187724== 917 bytes in 1 blocks are definitely lost in loss record 3,046 of 3,207
==187724== at 0x4C2EBAB: malloc (vg_replace_malloc.c:299)
==187724== by 0x563C435: g_malloc (in /usr/lib64/libglib-2.0.so.0.5600.3)
==187724== by 0x5655D82: g_strdup (in /usr/lib64/libglib-2.0.so.0.5600.3)
==187724== by 0x4E43937: py_str_as_str (util.c:371)
==187724== by 0x4E415E1: srd_decoder_doc_get (decoder.c:892)
==187724== by 0x40281D: test_doc_get (decoder.c:395)
==187724== by 0x53E51D5: srunner_run_tagged (in /usr/lib64/libcheck.so.0.0.0)
==187724== by 0x401237: main (main.c:51)
-rw-r--r-- | tests/decoder.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/tests/decoder.c b/tests/decoder.c index 2298d93..3678410 100644 --- a/tests/decoder.c +++ b/tests/decoder.c @@ -388,11 +388,14 @@ END_TEST START_TEST(test_doc_get) { struct srd_decoder *dec; + char *doc; srd_init(DECODERS_TESTDIR); srd_decoder_load("uart"); dec = srd_decoder_get_by_id("uart"); - fail_unless(srd_decoder_doc_get(dec) != NULL); + doc = srd_decoder_doc_get(dec); + fail_unless(doc != NULL); + g_free(doc); srd_exit(); } END_TEST |