From 673fb468362ae66051b63ab2e9caa9fcc224a18d Mon Sep 17 00:00:00 2001 From: Armin Novak Date: Wed, 8 Sep 2021 15:47:03 +0200 Subject: [PATCH] Fixed uninitialized warnings --- channels/urbdrc/client/libusb/libusb_udevman.c | 2 +- client/X11/xf_cliprdr.c | 12 ++++++------ libfreerdp/codec/clear.c | 6 +++--- libfreerdp/codec/rfx.c | 2 +- libfreerdp/core/gcc.c | 2 +- libfreerdp/core/nla.c | 12 ++++++------ libfreerdp/core/transport.h | 4 ++-- libfreerdp/primitives/prim_YUV_ssse3.c | 4 ++-- server/proxy/pf_server.h | 2 +- uwac/libuwac/uwac-input.c | 2 +- winpr/libwinpr/rpc/ndr_structure.c | 6 +++--- winpr/libwinpr/utils/collections/BufferPool.c | 2 +- winpr/libwinpr/utils/lodepng/lodepng.c | 2 +- 13 files changed, 29 insertions(+), 29 deletions(-) diff --git a/channels/urbdrc/client/libusb/libusb_udevman.c b/channels/urbdrc/client/libusb/libusb_udevman.c index 4921023c6..afbb333ae 100644 --- a/channels/urbdrc/client/libusb/libusb_udevman.c +++ b/channels/urbdrc/client/libusb/libusb_udevman.c @@ -862,7 +862,7 @@ static BOOL poll_libusb_events(UDEVMAN* udevman) static DWORD poll_thread(LPVOID lpThreadParameter) { - libusb_hotplug_callback_handle handle; + libusb_hotplug_callback_handle handle = 0; UDEVMAN* udevman = (UDEVMAN*)lpThreadParameter; BOOL hasHotplug = libusb_has_capability(LIBUSB_CAP_HAS_HOTPLUG); diff --git a/client/X11/xf_cliprdr.c b/client/X11/xf_cliprdr.c index af6b639ea..78bab8a97 100644 --- a/client/X11/xf_cliprdr.c +++ b/client/X11/xf_cliprdr.c @@ -702,7 +702,7 @@ static void xf_cliprdr_process_requested_data(xfClipboard* clipboard, BOOL hasDa { BOOL bSuccess; UINT32 SrcSize; - UINT32 DstSize; + UINT32 DstSize = 0; UINT32 srcFormatId; UINT32 dstFormatId; BYTE* pDstData = NULL; @@ -1393,7 +1393,7 @@ xf_cliprdr_server_file_contents_response(CliprdrClientContext* context, UINT32 count; UINT32 index; BOOL found = FALSE; - xfCliprdrFuseStream* stream; + xfCliprdrFuseStream* stream = NULL; xfCliprdrFuseInode* ino; xfClipboard* clipboard = (xfClipboard*)context->custom; UINT32 stream_id = fileContentsResponse->streamId; @@ -1413,7 +1413,7 @@ xf_cliprdr_server_file_contents_response(CliprdrClientContext* context, break; } } - if (!found) + if (!found || !stream) { ArrayList_Unlock(clipboard->stream_list); return CHANNEL_RC_OK; @@ -1775,7 +1775,7 @@ static BOOL xf_cliprdr_fuse_create_nodes(xfClipboard* clipboard, wStream* s, siz char* curName = NULL; char* dirName = NULL; char* baseName = NULL; - xfCliprdrFuseInode* inode; + xfCliprdrFuseInode* inode = NULL; wHashTable* mapDir = HashTable_New(TRUE); if (!mapDir) { @@ -2565,7 +2565,7 @@ static void xf_cliprdr_fuse_lookup(fuse_req_t req, fuse_ino_t parent, const char BOOL found = FALSE; struct fuse_entry_param e; xfCliprdrFuseInode* parent_node; - xfCliprdrFuseInode* child_node; + xfCliprdrFuseInode* child_node = NULL; xfClipboard* clipboard = (xfClipboard*)fuse_req_userdata(req); ArrayList_Lock(clipboard->ino_list); @@ -2592,7 +2592,7 @@ static void xf_cliprdr_fuse_lookup(fuse_req_t req, fuse_ino_t parent, const char } ArrayList_Unlock(parent_node->child_inos); - if (!found) + if (!found || !child_node) { ArrayList_Unlock(clipboard->ino_list); fuse_reply_err(req, ENOENT); diff --git a/libfreerdp/codec/clear.c b/libfreerdp/codec/clear.c index 0cd27eed3..d4e71fb26 100644 --- a/libfreerdp/codec/clear.c +++ b/libfreerdp/codec/clear.c @@ -616,11 +616,11 @@ static BOOL clear_decompress_bands_data(CLEAR_CONTEXT* clear, wStream* s, UINT32 UINT16 yEnd; UINT32 colorBkg; UINT16 vBarHeader; - UINT16 vBarYOn; + UINT16 vBarYOn = 0; UINT16 vBarYOff; UINT32 vBarCount; UINT32 vBarPixelCount; - UINT32 vBarShortPixelCount; + UINT32 vBarShortPixelCount = 0; if (Stream_GetRemainingLength(s) < 11) { @@ -656,7 +656,7 @@ static BOOL clear_decompress_bands_data(CLEAR_CONTEXT* clear, wStream* s, UINT32 { UINT32 vBarHeight; CLEAR_VBAR_ENTRY* vBarEntry = NULL; - CLEAR_VBAR_ENTRY* vBarShortEntry; + CLEAR_VBAR_ENTRY* vBarShortEntry = NULL; BOOL vBarUpdate = FALSE; const BYTE* cpSrcPixel; diff --git a/libfreerdp/codec/rfx.c b/libfreerdp/codec/rfx.c index b911fc3cb..c44f3d558 100644 --- a/libfreerdp/codec/rfx.c +++ b/libfreerdp/codec/rfx.c @@ -1456,7 +1456,7 @@ RFX_MESSAGE* rfx_encode_message(RFX_CONTEXT* context, const RFX_RECT* rects, siz const UINT32 width = (UINT32)w; const UINT32 height = (UINT32)h; const UINT32 scanline = (UINT32)s; - UINT32 i, maxNbTiles, maxTilesX, maxTilesY; + UINT32 i, maxNbTiles = 0, maxTilesX, maxTilesY; UINT32 xIdx, yIdx, regionNbRects; UINT32 gridRelX, gridRelY, ax, ay, bytesPerPixel; RFX_TILE* tile; diff --git a/libfreerdp/core/gcc.c b/libfreerdp/core/gcc.c index 55b5f43e6..ae339eda2 100644 --- a/libfreerdp/core/gcc.c +++ b/libfreerdp/core/gcc.c @@ -1413,7 +1413,7 @@ const BYTE tssk_exponent[] = { 0x5b, 0x7b, 0x88, 0xc0 }; BOOL gcc_write_server_security_data(wStream* s, rdpMcs* mcs) { BYTE* sigData; - size_t expLen, keyLen, sigDataLen; + size_t expLen = 0, keyLen, sigDataLen; BYTE encryptedSignature[TSSK_KEY_LENGTH]; BYTE signature[sizeof(initial_signature)]; UINT32 headerLen, serverRandomLen, serverCertLen, wPublicKeyBlobLen; diff --git a/libfreerdp/core/nla.c b/libfreerdp/core/nla.c index 386e0594f..3bfcb7000 100644 --- a/libfreerdp/core/nla.c +++ b/libfreerdp/core/nla.c @@ -1094,7 +1094,7 @@ static int nla_server_authenticate(rdpNla* nla) { int res = -1; if (nla_server_init(nla) < 1) - goto fail; + goto fail_auth; /* Client is starting, here es the state machine: * @@ -1135,13 +1135,13 @@ static int nla_server_authenticate(rdpNla* nla) inputBufferDesc.pBuffers = &inputBuffer; if (nla_server_recv(nla) < 0) - goto fail; + goto fail_auth; WLog_DBG(TAG, "Receiving Authentication Token"); if (!nla_sec_buffer_alloc_from_buffer(&inputBuffer, &nla->negoToken, 0)) { WLog_ERR(TAG, "CredSSP: invalid negoToken!"); - goto fail; + goto fail_auth; } outputBufferDesc.ulVersion = SECBUFFER_VERSION; @@ -1149,7 +1149,7 @@ static int nla_server_authenticate(rdpNla* nla) outputBufferDesc.pBuffers = &outputBuffer; if (!nla_sec_buffer_alloc(&outputBuffer, nla->cbMaxToken)) - goto fail; + goto fail_auth; nla->status = nla->table->AcceptSecurityContext( &nla->credentials, nla->haveContext ? &nla->context : NULL, &inputBufferDesc, @@ -1159,7 +1159,7 @@ static int nla_server_authenticate(rdpNla* nla) GetSecurityStatusString(nla->status), nla->status); if (!nla_sec_buffer_alloc_from_buffer(&nla->negoToken, &outputBuffer, 0)) - goto fail; + goto fail_auth; if ((nla->status == SEC_I_COMPLETE_AND_CONTINUE) || (nla->status == SEC_I_COMPLETE_NEEDED)) { @@ -1193,7 +1193,7 @@ static int nla_server_authenticate(rdpNla* nla) } if (!nla_complete_auth(nla, &outputBufferDesc)) - goto fail; + goto fail_auth; } if (nla->status == SEC_E_OK) diff --git a/libfreerdp/core/transport.h b/libfreerdp/core/transport.h index acb1c1ea0..e45deec19 100644 --- a/libfreerdp/core/transport.h +++ b/libfreerdp/core/transport.h @@ -113,8 +113,8 @@ FREERDP_LOCAL BOOL transport_set_connected_event(rdpTransport* transport); FREERDP_LOCAL BOOL transport_set_recv_callbacks(rdpTransport* transport, TransportRecv recv, void* extra); -FREERDP_LOCAL transport_tcp_connect(rdpTransport* transport, const char* hostname, int port, - DWORD timeout); +FREERDP_LOCAL int transport_tcp_connect(rdpTransport* transport, const char* hostname, int port, + DWORD timeout); FREERDP_LOCAL rdpTransport* transport_new(rdpContext* context); FREERDP_LOCAL void transport_free(rdpTransport* transport); diff --git a/libfreerdp/primitives/prim_YUV_ssse3.c b/libfreerdp/primitives/prim_YUV_ssse3.c index a2497605a..27ae8d256 100644 --- a/libfreerdp/primitives/prim_YUV_ssse3.c +++ b/libfreerdp/primitives/prim_YUV_ssse3.c @@ -553,7 +553,7 @@ static INLINE void ssse3_RGBToAVC444YUV_BGRX_DOUBLE_ROW(const BYTE* srcEven, con * * We need to split these according to * 3.3.8.3.2 YUV420p Stream Combination for YUV444 mode */ - __m128i ue, uo; + __m128i ue, uo = { 0 }; { const __m128i ue1 = _mm_srai_epi16(_mm_hadd_epi16(_mm_maddubs_epi16(xe1, u_factors), @@ -628,7 +628,7 @@ static INLINE void ssse3_RGBToAVC444YUV_BGRX_DOUBLE_ROW(const BYTE* srcEven, con * * We need to split these according to * 3.3.8.3.2 YUV420p Stream Combination for YUV444 mode */ - __m128i ve, vo; + __m128i ve, vo = { 0 }; { const __m128i ve1 = _mm_srai_epi16(_mm_hadd_epi16(_mm_maddubs_epi16(xe1, v_factors), diff --git a/server/proxy/pf_server.h b/server/proxy/pf_server.h index 1b9cc2c5e..de7ce6e3e 100644 --- a/server/proxy/pf_server.h +++ b/server/proxy/pf_server.h @@ -41,4 +41,4 @@ struct proxy_server HANDLE stopEvent; /* an event used to signal the main thread to stop */ }; -#endif /* FREERDP_SERVER_PROXY_SERVER_H */ +#endif /* INT_FREERDP_SERVER_PROXY_SERVER_H */ diff --git a/uwac/libuwac/uwac-input.c b/uwac/libuwac/uwac-input.c index 106f070d8..c32ec1597 100644 --- a/uwac/libuwac/uwac-input.c +++ b/uwac/libuwac/uwac-input.c @@ -93,7 +93,7 @@ static UwacReturnCode set_cursor_image(UwacSeat* seat, uint32_t serial) { struct wl_buffer* buffer = NULL; struct wl_cursor* cursor; - struct wl_cursor_image* image; + struct wl_cursor_image* image = NULL; struct wl_surface* surface = NULL; int32_t x = 0, y = 0; int buffer_add_listener_success = -1; diff --git a/winpr/libwinpr/rpc/ndr_structure.c b/winpr/libwinpr/rpc/ndr_structure.c index 3fb5e09fe..a962706f3 100644 --- a/winpr/libwinpr/rpc/ndr_structure.c +++ b/winpr/libwinpr/rpc/ndr_structure.c @@ -220,9 +220,9 @@ void NdrComplexStructBufferSize(PMIDL_STUB_MESSAGE pStubMsg, unsigned char* pMem * FC_END * [pointer_layout<>] */ - ULONG_PTR MaxCount; - unsigned long Offset; - unsigned long ActualCount; + ULONG_PTR MaxCount = 0; + unsigned long Offset = 0; + unsigned long ActualCount = 0; unsigned char* pMemoryCopy; unsigned char type; unsigned char alignment; diff --git a/winpr/libwinpr/utils/collections/BufferPool.c b/winpr/libwinpr/utils/collections/BufferPool.c index 3e3f5be57..f538a7539 100644 --- a/winpr/libwinpr/utils/collections/BufferPool.c +++ b/winpr/libwinpr/utils/collections/BufferPool.c @@ -225,7 +225,7 @@ void* BufferPool_Take(wBufferPool* pool, SSIZE_T size) SSIZE_T index; SSIZE_T maxSize; SSIZE_T maxIndex; - SSIZE_T foundIndex; + SSIZE_T foundIndex = -1; BOOL found = FALSE; void* buffer = NULL; diff --git a/winpr/libwinpr/utils/lodepng/lodepng.c b/winpr/libwinpr/utils/lodepng/lodepng.c index 1ead37b9f..c7b3f42f9 100644 --- a/winpr/libwinpr/utils/lodepng/lodepng.c +++ b/winpr/libwinpr/utils/lodepng/lodepng.c @@ -1507,7 +1507,7 @@ typedef struct Hash static unsigned hash_init(Hash* hash, unsigned windowsize) { - unsigned i; + unsigned i = 0; hash->head = (int*)calloc(sizeof(int), HASH_NUM_VALUES); hash->val = (int*)calloc(sizeof(int), windowsize); hash->chain = (unsigned short*)calloc(sizeof(unsigned short), windowsize);