Commit 63b6fac8 authored by Nicholas Hollingum's avatar Nicholas Hollingum Committed by Commit Bot

Fixed a memory leak in the fuzzer harness

We weren't freeing some objects that wayland allocates (and expects us
to free for ourselves).

Bug: 977600
Change-Id: I6e5441e92ec5e951d3e3ad3b9c431a7b3690d60c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1672078Reviewed-by: default avatarJoel Hockey <joelhockey@chromium.org>
Commit-Queue: Nic Hollingum <hollingum@google.com>
Cr-Commit-Position: refs/heads/master@{#671895}
parent 9279abb7
......@@ -76,10 +76,10 @@ namespace wayland_fuzzer {
{{arg.cpp_type}} {{arg.name}} = harness->get_{{arg.interface}}(action.{{arg.name}}());
{% if not arg.nullable %}
if (!{{arg.name}})
return;
return;
{% endif %}
{% elif arg.type == 'fd' %}
int {{arg.name}} = harness->GetFileDescriptor(action.{{arg.name}}());
{% elif arg.type == 'fd' %}
int {{arg.name}} = harness->GetFileDescriptor(action.{{arg.name}}());
{% endif %}
{% endfor %}
{% if request.is_constructor %}
......@@ -160,7 +160,16 @@ Harness::Harness() {
}
Harness::~Harness() {
wl_display_disconnect(wl_display_list_.front());
{% for interface in interfaces %}
for (auto ifc : {{interface.name}}_list_) {
if (ifc)
{% if interface.name == "wl_display" %}
wl_display_disconnect(ifc);
{% else %}
free(ifc);
{% endif %}
}
{% endfor %}
}
void Harness::Run(const actions::actions& all_steps) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment