Skip to content

Commit

Permalink
fix: check 'jack_free_description' function pointer before use (fixes #6
Browse files Browse the repository at this point in the history
)

Signed-off-by: Christopher Arndt <[email protected]>
  • Loading branch information
SpotlightKid committed Mar 26, 2022
1 parent 6d4c628 commit 70c2f7d
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions jacklib/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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
Expand All @@ -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


Expand Down

0 comments on commit 70c2f7d

Please sign in to comment.