From 2c5d0c1e3a58f97fed003fd0965bc20f72ad72a9 Mon Sep 17 00:00:00 2001 From: Zack Middleton Date: Mon, 7 May 2012 22:47:19 +0000 Subject: [PATCH] Fixed two issues pointed out in a PVS-Studio static code analyzer article (bug #5505). --- code/cgame/cg_weapons.c | 2 +- code/ui/ui_shared.c | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/code/cgame/cg_weapons.c b/code/cgame/cg_weapons.c index f48dcb72..64452411 100644 --- a/code/cgame/cg_weapons.c +++ b/code/cgame/cg_weapons.c @@ -842,7 +842,7 @@ void CG_RegisterItemVisuals( int itemNum ) { item = &bg_itemlist[ itemNum ]; - memset( itemInfo, 0, sizeof( &itemInfo ) ); + memset( itemInfo, 0, sizeof( *itemInfo ) ); itemInfo->registered = qtrue; itemInfo->models[0] = trap_R_RegisterModel( item->world_model[0] ); diff --git a/code/ui/ui_shared.c b/code/ui/ui_shared.c index 15d8ac46..887a9872 100644 --- a/code/ui/ui_shared.c +++ b/code/ui/ui_shared.c @@ -3831,7 +3831,8 @@ void Item_OwnerDraw_Paint(itemDef_t *item) { void Item_Paint(itemDef_t *item) { vec4_t red; - menuDef_t *parent = (menuDef_t*)item->parent; + menuDef_t *parent; + red[0] = red[3] = 1; red[1] = red[2] = 0; @@ -3839,6 +3840,8 @@ void Item_Paint(itemDef_t *item) { return; } + parent = (menuDef_t*)item->parent; + if (item->window.flags & WINDOW_ORBITING) { if (DC->realTime > item->window.nextTime) { float rx, ry, a, c, s, w, h;