Skip to content

ui/vnc: Do not copy z_stream

Akihiko Odaki qemu-devel 3 versions – In review

Get series with b4
b4 am [email protected] change-id 20250417-zlib-ce3034f8bc3c

Versions newest first

  1. v3 Latest2 patches 3 repliesIn review
  2. v22 patches 1 replySuperseded
  3. v12 patches 1 replySuperseded

Changes in v3 from the cover letter

- Rebased.
- Reordered the patches.
- Removed the extra allocation of VncWorker.
- Removed the worker field from VncState.
- Dropped the Reviewed-by tags.
- Link to v2: https://lore.kernel.org/qemu-devel/[email protected]

Patches in v3 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2ui/vnc: Do not copy z_streamui/vnc-enc-zlib.c ui/vnc.c ui/vnc.h+26 -192 replies
2/2ui/vnc: Introduce the VncWorker typeui/vnc-enc-tight.c ui/vnc-enc-zlib.c ui/vnc-enc-zrle.c +4 more+405 -3881 reply

Reviews trailers per patch

All 2 patches have a Reviewed-by or Acked-by.

PatchPhilippe Mathieu-DaudéMarc-André Lureau
1/2R-b R-b
2/2R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v3 thread

Cover letter [PATCH v3 0/2] 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.

---
Changes in v3:
- Rebased.
- Reordered the patches.
- Removed the extra allocation of VncWorker.
- Removed the worker field from VncState.
- Dropped the Reviewed-by tags.
- Link to v2: https://lore.kernel.org/qemu-devel/[email protected]

Changes in v2:
- Rebased.
- Link to v1: https://lore.kernel.org/qemu-devel/[email protected]

---
Akihiko Odaki (2):
ui/vnc: Do not copy z_stream
ui/vnc: Introduce the VncWorker type

 ui/vnc.h              |  49 ++++--
 ui/vnc-enc-tight.c    | 456 ++++++++++++++++++++++++++------------------------
 ui/vnc-enc-zlib.c     |  47 +++---
 ui/vnc-enc-zrle.c     | 122 +++++++-------
 ui/vnc-jobs.c         |  13 +-
 ui/vnc.c              |  83 ++++-----
 ui/vnc-enc-zrle.c.inc |  20 +--
 7 files changed, 407 insertions(+), 383 deletions(-)

---
base-commit: 6322b753f798337835e205b6d805356bea582c86
change-id: 20250417-zlib-ce3034f8bc3c

Best regards,

Signature · 1 line
Akihiko Odaki <[email protected]>