ui/console: fix three double frees in png_save()
commit17b55372b509a253abed9d7d4a81772f6067220f
authorVolker Rümelin <vr_qemu@t-online.de>
Mon, 19 Sep 2022 06:19:56 +0000 (19 08:19 +0200)
committerGerd Hoffmann <kraxel@redhat.com>
Fri, 23 Sep 2022 12:38:27 +0000 (23 14:38 +0200)
tree5b67c3d1627cc0277c030055bb3525610786567f
parentd18431547f388db1e43c0cbc8a423ea9cc0df3d6
ui/console: fix three double frees in png_save()

The png_destroy_write_struct() function frees all memory used by
libpng. Don't use the glib auto cleanup mechanism to free the
memory allocated by libpng again. For the pixman image, use only the
auto cleanup mechanism and remove the qemu_pixman_image_unref()
function call to prevent another double free.

Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1210
Fixes: 9a0a119a38 ("Added parameter to take screenshot with screendump as PNG")
Tested-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Signed-off-by: Volker Rümelin <vr_qemu@t-online.de>
Message-Id: <20220919061956.30929-1-vr_qemu@t-online.de>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
ui/console.c