mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 01:58:19 +00:00
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:
parent
fc180562f6
commit
b745d75306
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue