Fixed memory sanitizer warnings

This commit is contained in:
Armin Novak 2022-01-10 16:55:48 +01:00 committed by akallabeth
parent 004a0984b9
commit 339cdded45
6 changed files with 26 additions and 26 deletions

View File

@ -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));
}

View File

@ -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;

View File

@ -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;

View File

@ -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))

View File

@ -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);

View File

@ -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)