From ce174b991223c85afba55a24e7adc9c8156f7d48 Mon Sep 17 00:00:00 2001 From: Cyrille Bagard Date: Fri, 29 May 2020 00:31:42 +0200 Subject: Fixed several memory leaks. --- plugins/pychrysalide/arch/operand.c | 6 ++++++ plugins/pychrysalide/arch/processor.c | 14 ++++++++++++++ plugins/pychrysalide/arch/register.c | 10 ++++++++++ plugins/pychrysalide/format/format.c | 2 ++ plugins/pychrysalide/format/known.c | 8 ++++++++ plugins/pychrysalide/glibext/linegen.c | 10 ++++++++++ 6 files changed, 50 insertions(+) diff --git a/plugins/pychrysalide/arch/operand.c b/plugins/pychrysalide/arch/operand.c index f14a6cc..019e4a2 100644 --- a/plugins/pychrysalide/arch/operand.c +++ b/plugins/pychrysalide/arch/operand.c @@ -230,6 +230,8 @@ static int py_arch_operand___cmp___wrapper(const GArchOperand *a, const GArchOpe } + Py_DECREF(pyobj); + PyGILState_Release(gstate); return result; @@ -282,6 +284,8 @@ static void py_arch_operand_print_wrapper(const GArchOperand *operand, GBufferLi } + Py_DECREF(pyobj); + PyGILState_Release(gstate); } @@ -348,6 +352,8 @@ static char *py_arch_operand_build_tooltip_wrapper(const GArchOperand *operand, } + Py_DECREF(pyobj); + PyGILState_Release(gstate); return result; diff --git a/plugins/pychrysalide/arch/processor.c b/plugins/pychrysalide/arch/processor.c index bd1b521..10fcf03 100644 --- a/plugins/pychrysalide/arch/processor.c +++ b/plugins/pychrysalide/arch/processor.c @@ -369,6 +369,8 @@ static char *py_arch_processor_get_key_wrapper(const GArchProcessor *proc) } + Py_DECREF(pyobj); + PyGILState_Release(gstate); return result; @@ -419,6 +421,8 @@ static char *py_arch_processor_get_desc_wrapper(const GArchProcessor *proc) } + Py_DECREF(pyobj); + PyGILState_Release(gstate); return result; @@ -469,6 +473,8 @@ static MemoryDataSize py_arch_processor_get_memory_size_wrapper(const GArchProce } + Py_DECREF(pyobj); + PyGILState_Release(gstate); return result; @@ -519,6 +525,8 @@ static MemoryDataSize py_arch_processor_get_instruction_min_size_wrapper(const G } + Py_DECREF(pyobj); + PyGILState_Release(gstate); return result; @@ -569,6 +577,8 @@ static bool py_arch_processor_has_virtual_space_wrapper(const GArchProcessor *pr } + Py_DECREF(pyobj); + PyGILState_Release(gstate); return result; @@ -636,6 +646,8 @@ static GProcContext *py_arch_processor_get_context_wrapper(const GArchProcessor } + Py_DECREF(pyobj); + PyGILState_Release(gstate); return result; @@ -712,6 +724,8 @@ static GArchInstruction *py_arch_processor_disassemble_wrapper(const GArchProces } + Py_DECREF(pyobj); + PyGILState_Release(gstate); return result; diff --git a/plugins/pychrysalide/arch/register.c b/plugins/pychrysalide/arch/register.c index 2a407b5..61da77f 100644 --- a/plugins/pychrysalide/arch/register.c +++ b/plugins/pychrysalide/arch/register.c @@ -236,6 +236,8 @@ static guint py_arch_register___hash___wrapper(const GArchRegister *reg) } + Py_DECREF(pyobj); + PyGILState_Release(gstate); return result; @@ -302,6 +304,8 @@ static int py_arch_register___cmp___wrapper(const GArchRegister *a, const GArchR } + Py_DECREF(pyobj); + PyGILState_Release(gstate); return result; @@ -354,6 +358,8 @@ static void py_arch_register_print_wrapper(const GArchRegister *reg, GBufferLine } + Py_DECREF(pyobj); + PyGILState_Release(gstate); } @@ -406,6 +412,8 @@ static bool py_arch_register_is_base_pointer_wrapper(const GArchRegister *reg) } + Py_DECREF(pyobj); + PyGILState_Release(gstate); return result; @@ -460,6 +468,8 @@ static bool py_arch_register_is_stack_pointer_wrapper(const GArchRegister *reg) } + Py_DECREF(pyobj); + PyGILState_Release(gstate); return result; diff --git a/plugins/pychrysalide/format/format.c b/plugins/pychrysalide/format/format.c index 1b34b38..6761392 100644 --- a/plugins/pychrysalide/format/format.c +++ b/plugins/pychrysalide/format/format.c @@ -290,6 +290,8 @@ static SourceEndian py_binary_format_get_endianness_wrapper(const GBinFormat *fo } + Py_DECREF(pyobj); + PyGILState_Release(gstate); return result; diff --git a/plugins/pychrysalide/format/known.c b/plugins/pychrysalide/format/known.c index ff4ca0a..a2fc18c 100644 --- a/plugins/pychrysalide/format/known.c +++ b/plugins/pychrysalide/format/known.c @@ -281,6 +281,8 @@ static char *py_known_format_get_key_wrapper(const GKnownFormat *format) } + Py_DECREF(pyobj); + PyGILState_Release(gstate); return result; @@ -340,6 +342,8 @@ static char *py_known_format_get_description_wrapper(const GKnownFormat *format) } + Py_DECREF(pyobj); + PyGILState_Release(gstate); return result; @@ -406,6 +410,8 @@ static bool py_known_format_analyze_wrapper(GKnownFormat *format, wgroup_id_t gi } + Py_DECREF(pyobj); + PyGILState_Release(gstate); return result; @@ -464,6 +470,8 @@ static void py_known_format_complete_analysis_wrapper(GKnownFormat *format, wgro } + Py_DECREF(pyobj); + PyGILState_Release(gstate); } diff --git a/plugins/pychrysalide/glibext/linegen.c b/plugins/pychrysalide/glibext/linegen.c index 9001b71..3214cc9 100644 --- a/plugins/pychrysalide/glibext/linegen.c +++ b/plugins/pychrysalide/glibext/linegen.c @@ -181,6 +181,8 @@ static size_t py_line_generator_count_lines_wrapper(const GLineGenerator *genera } + Py_DECREF(pyobj); + PyGILState_Release(gstate); return result; @@ -255,6 +257,8 @@ static void py_line_generator_compute_cursor_wrapper(const GLineGenerator *gener } + Py_DECREF(pyobj); + PyGILState_Release(gstate); } @@ -331,6 +335,8 @@ static int py_line_generator_contain_cursor_wrapper(const GLineGenerator *genera } + Py_DECREF(pyobj); + PyGILState_Release(gstate); return result; @@ -405,6 +411,8 @@ static BufferLineFlags py_line_generator_get_flags_wrapper(const GLineGenerator } + Py_DECREF(pyobj); + PyGILState_Release(gstate); return result; @@ -471,6 +479,8 @@ static void py_line_generator_print_wrapper(GLineGenerator *generator, GBufferLi } + Py_DECREF(pyobj); + PyGILState_Release(gstate); } -- cgit v0.11.2-87-g4458