Skip to content

Fix various defects reported by covscan

Ondrej Holy requested to merge wip/oholy/covescan-fixes into master

This patch fixes the following important defects reported by covscan:

server/libvncserver/main.c:178: leaked_storage: Variable "i" going out of scope leaks the storage it points to.
server/libvncserver/rfbserver.c:195: leaked_storage: Variable "cl" going out of scope leaks the storage it points to.
server/libvncserver/rfbserver.c:1161: overwrite_var: Overwriting "i" in "i = sraRgnGetIterator(updateRegion)" leaks the storage that "i"
server/libvncserver/rfbserver.c:1232: deref_arg: Calling "sraRgnReleaseIterator" dereferences freed pointer "i".
server/libvncserver/rfbserver.c:1291: leaked_storage: Variable "i" going out of scope leaks the storage it points to.
server/libvncserver/sockets.c:635: leaked_handle: Handle variable "sock" going out of scope leaks the handle.
server/libvncserver/sockets.c:635: leaked_handle: Handle variable "sock6" going out of scope leaks the handle.
server/libvncserver/sockets.c:639: leaked_handle: Handle variable "sock" going out of scope leaks the handle.
server/libvncserver/sockets.c:639: leaked_handle: Handle variable "sock6" going out of scope leaks the handle.
server/libvncserver/sockets.c:663: overwrite_var: Overwriting handle "sock" in "sock = NewSocketListenTCP((struct sockaddr *)s4, 16U)" leaks the handle.
server/libvncserver/sockets.c:677: overwrite_var: Overwriting handle "sock" in "sock = NewSocketListenTCP((struct sockaddr *)s6, 46U)" leaks the handle.
server/libvncserver/sockets.c:691: leaked_handle: Handle variable "sock" going out of scope leaks the handle.
server/libvncserver/tableinit24.c:150:7: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
server/miniupnp/minissdpc.c:43: buffer_size_warning: Calling strncpy with a maximum size argument of 108 bytes on destination array "addr.sun_path" of size 108 bytes might leave the destination string unterminated.
server/miniupnp/miniupnpc.c:405: leaked_handle: Handle variable "sudp" going out of scope leaks the handle.
server/smclient/eggsmclient-xsmp.c:1171: missing_va_end: va_end was not called for "ap".

See the whole covscan report for more details.

Merge request reports