diff options
author | Marc-André Lureau <marcandre.lureau@redhat.com> | 2016-07-13 12:56:01 +0200 |
---|---|---|
committer | Marc-André Lureau <marcandre.lureau@redhat.com> | 2016-09-08 18:05:21 +0400 |
commit | 354fb471bd5faf527f3fa25388b8cffa6bd937d0 (patch) | |
tree | b0065568a4dc05f2b08d8b5416d478abf6ff12c5 | |
parent | 8ea753718b2d1a42e9ce7b8db9f5e4e1f330e827 (diff) | |
download | qemu-354fb471bd5faf527f3fa25388b8cffa6bd937d0.tar.gz qemu-354fb471bd5faf527f3fa25388b8cffa6bd937d0.tar.bz2 qemu-354fb471bd5faf527f3fa25388b8cffa6bd937d0.zip |
acpi-build: fix array leak
The free_ranges array is used as a temporary pointer array, the segment
should still be freed, however, it shouldn't free the elements themself.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Tested-by: Marcel Apfelbaum <marcel@redhat.com>
Reviewed-by: Marcel Apfelbaum <marcel@redhat.com>
-rw-r--r-- | hw/i386/acpi-build.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c index a26a4bb03f..433febafdd 100644 --- a/hw/i386/acpi-build.c +++ b/hw/i386/acpi-build.c @@ -789,7 +789,7 @@ static gint crs_range_compare(gconstpointer a, gconstpointer b) static void crs_replace_with_free_ranges(GPtrArray *ranges, uint64_t start, uint64_t end) { - GPtrArray *free_ranges = g_ptr_array_new_with_free_func(crs_range_free); + GPtrArray *free_ranges = g_ptr_array_new(); uint64_t free_base = start; int i; @@ -813,7 +813,7 @@ static void crs_replace_with_free_ranges(GPtrArray *ranges, g_ptr_array_add(ranges, g_ptr_array_index(free_ranges, i)); } - g_ptr_array_free(free_ranges, false); + g_ptr_array_free(free_ranges, true); } /* |