]> git.ipfire.org Git - thirdparty/qemu.git/commit
ui/vnc: Do not copy z_stream
authorAkihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>
Tue, 3 Jun 2025 09:18:28 +0000 (18:18 +0900)
committerMarc-André Lureau <marcandre.lureau@redhat.com>
Mon, 14 Jul 2025 10:50:44 +0000 (14:50 +0400)
commitaef22331b5a4670f42638a5f63a26e93bf779aae
tree10aa3913e7e991f1bc1808c590d7dcd3f6b978db
parent9a4e273ddec3927920c5958d2226c6b38b543336
ui/vnc: Do not copy z_stream

vnc_worker_thread_loop() copies z_stream stored in its local VncState to
the persistent VncState, and the copied one is freed with deflateEnd()
later. However, deflateEnd() refuses to operate with a copied z_stream
and returns Z_STREAM_ERROR, leaking the allocated memory.

Avoid copying the zlib state to fix the memory leak.

Fixes: bd023f953e5e ("vnc: threaded VNC server")
Signed-off-by: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-Id: <20250603-zlib-v3-1-20b857bd8d05@rsg.ci.i.u-tokyo.ac.jp>
ui/vnc-enc-zlib.c
ui/vnc.c
ui/vnc.h