diff options
author | Cyrille Bagard <nocbos@gmail.com> | 2020-03-15 20:04:26 (GMT) |
---|---|---|
committer | Cyrille Bagard <nocbos@gmail.com> | 2020-03-15 20:04:26 (GMT) |
commit | 8cfbcf2db62a65766e02618840c6296ba7d083d0 (patch) | |
tree | ab7f930a8c16f839ca46f8c88da61d8bb2b16de0 /plugins/elf/python/dynamic.c | |
parent | 46cf7042cf511215001bb28c072821998a83d011 (diff) |
Improved the Python API for ELF dynamic items.
Diffstat (limited to 'plugins/elf/python/dynamic.c')
-rw-r--r-- | plugins/elf/python/dynamic.c | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/plugins/elf/python/dynamic.c b/plugins/elf/python/dynamic.c index aaf4f6a..974b751 100644 --- a/plugins/elf/python/dynamic.c +++ b/plugins/elf/python/dynamic.c @@ -145,22 +145,14 @@ PyObject *py_elf_format_get_needed(PyObject *self, void *closure) needed = list_elf_needed_objects(format, &count); - if (count > 0) - { - result = PyTuple_New(count); + result = PyTuple_New(count); - for (i = 0; i < count; i++) - PyTuple_SetItem(result, i, PyUnicode_FromString(needed[i])); + for (i = 0; i < count; i++) + PyTuple_SetItem(result, i, PyUnicode_FromString(needed[i])); + if (needed != NULL) free(needed); - } - else - { - result = Py_None; - Py_INCREF(result); - } - return result; } |