diff options
author | Jon Burgess <jburgess777@gmail.com> | 2018-10-14 18:55:47 +0100 |
---|---|---|
committer | Uwe Hermann <uwe@hermann-uwe.de> | 2018-10-21 16:39:33 +0200 |
commit | 07560450ad9427b01b99f4b3b10483e7fdf3926f (patch) | |
tree | e7838e36bd84c3d9a5d176d07faad4a3dd6fd033 | |
parent | 611a73404f1a42aa92fb32f00ca5407e1cdb2c71 (diff) | |
download | libsigrokdecode-07560450ad9427b01b99f4b3b10483e7fdf3926f.tar.gz libsigrokdecode-07560450ad9427b01b99f4b3b10483e7fdf3926f.zip |
Fix memory leak in print_searchpaths()
==175453== 522 bytes in 8 blocks are definitely lost in loss record 2,923 of 3,201
==175453== at 0x4C2EBAB: malloc (vg_replace_malloc.c:299)
==175453== by 0x59E9BB5: PyObject_Malloc (in /usr/lib64/libpython3.6m.so.1.0)
==175453== by 0x5A35A76: PyBytes_FromStringAndSize (in /usr/lib64/libpython3.6m.so.1.0)
==175453== by 0x4E3FA6E: print_searchpaths (srd.c:173)
==175453== by 0x4E3FA6E: srd_init (srd.c:287)
==175453== by 0x4034BE: test_session_reset_nodata (session.c:238)
==175453== by 0x53E51D5: srunner_run_tagged (in /usr/lib64/libcheck.so.0.0.0)
==175453== by 0x401237: main (main.c:51)
-rw-r--r-- | srd.c | 1 |
1 files changed, 1 insertions, 0 deletions
@@ -172,6 +172,7 @@ static int print_searchpaths(void) py_path = PyList_GetItem(py_paths, i); py_bytes = PyUnicode_AsUTF8String(py_path); g_string_append_printf(s, " - %s\n", PyBytes_AsString(py_bytes)); + Py_DECREF(py_bytes); } s->str[s->len - 1] = '\0'; srd_dbg("%s", s->str); |