Skip to content

Commit

Permalink
win-syscalls: fix memory leaks introduced in #1721 (#1747)
Browse files Browse the repository at this point in the history
  • Loading branch information
disaykin authored Nov 27, 2023
1 parent b671aa2 commit c8e080b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
11 changes: 11 additions & 0 deletions src/plugins/syscalls/win.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -786,3 +786,14 @@ void win_syscalls::print_syscall(
std::move(fmt_args)
);
}

win_syscalls::~win_syscalls()
{
GSList* loop = this->strings_to_free;
while (loop)
{
g_free(loop->data);
loop = loop->next;
}
g_slist_free(this->strings_to_free);
}
3 changes: 2 additions & 1 deletion src/plugins/syscalls/win.h
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@
class win_syscalls : public syscalls_base
{
public:
GSList* strings_to_free;
GSList* strings_to_free = nullptr;

std::array<std::array<addr_t, 2>, 2> sst;

Expand Down Expand Up @@ -139,6 +139,7 @@ class win_syscalls : public syscalls_base
void print_syscall(drakvuf_t drakvuf, drakvuf_trap_info_t* info, int nr, const char* module, const syscalls_ns::syscall_t* sc, std::vector<uint64_t> args, privilege_mode_t mode, std::optional<std::string> from_dll);

win_syscalls(drakvuf_t drakvuf, const syscalls_config* config, output_format_t output);
~win_syscalls();
};

namespace syscalls_ns
Expand Down

0 comments on commit c8e080b

Please sign in to comment.