Fix alignment of vote option heap entries with remove_vote

When using the `remove_vote` command, the entire heap of vote options is allocated again without the entry being removed. This allocation was not considering the required alignment for `CVoteOptionServer` objects and potentially wasting space by aligning with `alignof(std::max_align_t)`. When allocating the entries with the `add_vote` command, the alignment is already specified correctly.
This commit is contained in:
Robert Müller 2024-05-03 18:12:25 +02:00
parent fc180562f6
commit b745d75306

View file

@ -3277,7 +3277,7 @@ void CGameContext::ConRemoveVote(IConsole::IResult *pResult, void *pUserData)
// copy option
int Len = str_length(pSrc->m_aCommand);
CVoteOptionServer *pDst = (CVoteOptionServer *)pVoteOptionHeap->Allocate(sizeof(CVoteOptionServer) + Len);
CVoteOptionServer *pDst = (CVoteOptionServer *)pVoteOptionHeap->Allocate(sizeof(CVoteOptionServer) + Len, alignof(CVoteOptionServer));
pDst->m_pNext = 0;
pDst->m_pPrev = pVoteOptionLast;
if(pDst->m_pPrev)