diff --git a/client/X11/xf_client.c b/client/X11/xf_client.c index ca7179949..9100ed463 100644 --- a/client/X11/xf_client.c +++ b/client/X11/xf_client.c @@ -834,14 +834,13 @@ void xf_unlock_x11_(xfContext* xfc, const char* fkt) static BOOL xf_get_pixmap_info(xfContext* xfc) { int i; - int vi_count; - int pf_count; - XVisualInfo* vi; - XVisualInfo* vis; - XVisualInfo tpl; - XPixmapFormatValues* pf; - XPixmapFormatValues* pfs; - XWindowAttributes window_attributes; + int vi_count = 0; + int pf_count = 0; + XVisualInfo* vi = NULL; + XVisualInfo* vis = NULL; + XVisualInfo tpl = { 0 }; + XPixmapFormatValues* pfs = NULL; + XWindowAttributes window_attributes = { 0 }; WINPR_ASSERT(xfc->display); pfs = XListPixmapFormats(xfc->display, &pf_count); @@ -853,7 +852,7 @@ static BOOL xf_get_pixmap_info(xfContext* xfc) for (i = 0; i < pf_count; i++) { - pf = pfs + i; + const XPixmapFormatValues* pf = &pfs[i]; if (pf->depth == xfc->depth) { @@ -863,7 +862,7 @@ static BOOL xf_get_pixmap_info(xfContext* xfc) } XFree(pfs); - ZeroMemory(&tpl, sizeof(tpl)); + tpl.class = TrueColor; tpl.screen = xfc->screen_number; @@ -1953,7 +1952,8 @@ static BOOL xfreerdp_client_new(freerdp* instance, rdpContext* context) if ((status == Success) && (actual_type == XA_ATOM) && (actual_format == 32)) { xfc->supportedAtomCount = nitems; - xfc->supportedAtoms = calloc(nitems, sizeof(Atom)); + xfc->supportedAtoms = calloc(xfc->supportedAtomCount, sizeof(Atom)); + WINPR_ASSERT(xfc->supportedAtoms); memcpy(xfc->supportedAtoms, data, nitems * sizeof(Atom)); } diff --git a/client/X11/xf_monitor.c b/client/X11/xf_monitor.c index 8d7e47c3a..f02dbade5 100644 --- a/client/X11/xf_monitor.c +++ b/client/X11/xf_monitor.c @@ -136,14 +136,14 @@ BOOL xf_detect_monitors(xfContext* xfc, UINT32* pMaxWidth, UINT32* pMaxHeight) int nmonitors = 0; int monitor_index = 0; BOOL primaryMonitorFound = FALSE; - VIRTUAL_SCREEN* vscreen; - rdpSettings* settings; - int mouse_x, mouse_y, _dummy_i; - Window _dummy_w; + VIRTUAL_SCREEN* vscreen = NULL; + rdpSettings* settings = NULL; + int mouse_x = 0, mouse_y = 0, _dummy_i = 0; + Window _dummy_w = 0; int current_monitor = 0; - Screen* screen; + Screen* screen = NULL; #if defined WITH_XINERAMA || defined WITH_XRANDR - int major, minor; + int major = 0, minor = 0; #endif #if defined(USABLE_XRANDR) XRRMonitorInfo* rrmonitors = NULL; diff --git a/client/X11/xf_window.c b/client/X11/xf_window.c index 5ec165396..5d48248d3 100644 --- a/client/X11/xf_window.c +++ b/client/X11/xf_window.c @@ -345,9 +345,9 @@ void xf_SetWindowFullscreen(xfContext* xfc, xfWindow* window, BOOL fullscreen) BOOL xf_GetWindowProperty(xfContext* xfc, Window window, Atom property, int length, unsigned long* nitems, unsigned long* bytes, BYTE** prop) { - int status; - Atom actual_type; - int actual_format; + int status = 0; + Atom actual_type = None; + int actual_format = 0; if (property == None) return FALSE; diff --git a/libfreerdp/core/settings.c b/libfreerdp/core/settings.c index cf2c4adcd..c4f78a04a 100644 --- a/libfreerdp/core/settings.c +++ b/libfreerdp/core/settings.c @@ -248,7 +248,7 @@ static void settings_load_hkey_local_machine(rdpSettings* settings) static BOOL settings_get_computer_name(rdpSettings* settings) { - CHAR computerName[256]; + CHAR computerName[256] = { 0 }; DWORD nSize = sizeof(computerName); if (!GetComputerNameExA(ComputerNameNetBIOS, computerName, &nSize)) diff --git a/libfreerdp/locale/keyboard_xkbfile.c b/libfreerdp/locale/keyboard_xkbfile.c index 047782a0e..bdf9a390d 100644 --- a/libfreerdp/locale/keyboard_xkbfile.c +++ b/libfreerdp/locale/keyboard_xkbfile.c @@ -383,12 +383,12 @@ static char* comma_substring(char* s, int n) int detect_keyboard_layout_from_xkbfile(void* display, DWORD* keyboardLayoutId) { - char* layout; - char* variant; + char* layout = NULL; + char* variant = NULL; DWORD group = 0; - XkbStateRec state; + XkbStateRec state = { 0 }; XKeyboardState coreKbdState; - XkbRF_VarDefsRec rules_names; + XkbRF_VarDefsRec rules_names = { 0 }; DEBUG_KBD("display: %p", display); diff --git a/winpr/libwinpr/utils/wlog/wlog.c b/winpr/libwinpr/utils/wlog/wlog.c index 3fba3cc82..c9e20f14f 100644 --- a/winpr/libwinpr/utils/wlog/wlog.c +++ b/winpr/libwinpr/utils/wlog/wlog.c @@ -375,7 +375,7 @@ BOOL WLog_PrintMessageVA(wLog* log, DWORD type, DWORD level, size_t line, const } else { - char formattedLogMessage[WLOG_MAX_STRING_SIZE]; + char formattedLogMessage[WLOG_MAX_STRING_SIZE] = { 0 }; if (wvsnprintfx(formattedLogMessage, WLOG_MAX_STRING_SIZE - 1, message.FormatString, args) < 0)