Patches
Hello, This is a bunch of patches for bugs reported by PVS-Studio.
If realloc fails, the whole array is lost. cd1e96e8: xcursor: avoid leak and loss of all cursors if cursors realloc fails b894c55c: render/drm: keep old drm_format if realloc fails
Remove dead code and trivial fixes. cd91349c: backend/session: non-void function should return a value 364c7913: xdg_shell: remove variable self-assignment af02f97a: wlr_surface: condition is always false a1c2bc22: Simplify check 96fa3c2e: Fix memory leak
There are also around 20 reports for calloc
, strdup
calls that are not checked for possible null returns. I don’t know how serious you are about enforcing this kind of checks, so I did not make a patch for it.
See inline for comments on the other commits.
PVS-Studio also reports two errors that I'm not sure how to fix:
-
There are identical sub-expressions
(unsigned) current.preedit.cursor_begin > strlen(preedit_text)
to the left and to the right of the||
operator. https://github.com/swaywm/wlroots/blob/58b2584863201f32d1a4770a1d5cde5e57b300c6/examples/text-input.c#L140-L141 Edit: fixed in baffb904: examples: remove duplicated condition -
The
surface
pointer was utilized before it was verified against nullptr. Check lines: 272, 280. https://github.com/swaywm/wlroots/blob/58b2584863201f32d1a4770a1d5cde5e57b300c6/types/seat/wlr_seat_keyboard.c#L272
Thanks for the great work!