From 70c2f7d67c8d2b4c23ee233c91b337efbe79e45a Mon Sep 17 00:00:00 2001 From: Christopher Arndt Date: Fri, 25 Mar 2022 15:44:36 +0100 Subject: [PATCH] fix: check 'jack_free_description' function pointer before use (fixes #6) Signed-off-by: Christopher Arndt --- jacklib/api.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/jacklib/api.py b/jacklib/api.py index 35de59b..5d2c49f 100644 --- a/jacklib/api.py +++ b/jacklib/api.py @@ -1663,7 +1663,8 @@ def uuid_unparse(uuid, encoding=ENCODING): def free_description(description, free_description_itself=0): - jlib.jack_free_description(description, free_description_itself) + if jlib.jack_free_description: + jlib.jack_free_description(description, free_description_itself) def _decode_property(prop, encoding=ENCODING): @@ -1707,7 +1708,7 @@ def get_all_properties(encoding=ENCODING): for p_idx in range(description.property_cnt) ] - jlib.jack_free_description(description, 0) + free_description(description, 0) free(descriptions) return results @@ -1722,7 +1723,7 @@ def get_properties(subject, encoding=ENCODING): for p_idx in range(description.property_cnt): results.append(_decode_property(description.properties[p_idx], encoding)) - jlib.jack_free_description(byref(description), 0) + free_description(byref(description), 0) return results