Skip to content

Commit

Permalink
Fixed|libcommon: Intermittent read access violation in XG
Browse files Browse the repository at this point in the history
The XG system assumes in numerous places that the data values stored
in an xgline_t are zero-initialized. However, not all allocators made
sure to initialize the data; XL_SetLineType() and XL_DoChain() failed
to do so.
  • Loading branch information
danij-deng committed Mar 6, 2013
1 parent 285dcf8 commit ae3e227
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions doomsday/plugins/common/src/p_xgline.c
Expand Up @@ -611,7 +611,7 @@ void XL_SetLineType(LineDef* line, int id)

// Allocate memory for the line type data.
if(!xline->xg)
xline->xg = Z_Malloc(sizeof(xgline_t), PU_MAP, 0);
xline->xg = Z_Calloc(sizeof(xgline_t), PU_MAP, 0);

// Init the extended line state.
xline->xg->disabled = false;
Expand Down Expand Up @@ -2530,7 +2530,7 @@ void XL_DoChain(LineDef* lineDef, int chain, boolean activating, mobj_t* actThin
// We'll use dummies for the chain.
dummyLineDef = P_AllocDummyLine();
xdummyLineDef = P_ToXLine(dummyLineDef);
xdummyLineDef->xg = Z_Malloc(sizeof(xgline_t), PU_MAP, 0);
xdummyLineDef->xg = Z_Calloc(sizeof(xgline_t), PU_MAP, 0);
dummyFrontSideDef = P_AllocDummySideDef();
P_SetPtrp(dummyLineDef, DMU_SIDEDEF0, dummyFrontSideDef);
P_SetPtrp(dummyFrontSideDef, DMU_LINEDEF, dummyLineDef);
Expand Down

0 comments on commit ae3e227

Please sign in to comment.