Fix ASAN crashes and LSAN leaks (#7649)

This commit is contained in:
Vincent Stumpf
2023-03-20 09:32:41 -07:00
committed by GitHub
parent 4d9b1a0b83
commit 819b7cb361
8 changed files with 15 additions and 6 deletions

View File

@@ -18020,7 +18020,7 @@ BUILDIN_FUNC(npcshopdelitem)
ARR_FIND( 0, size, n, nd->u.shop.shop_item[n].nameid == nameid );
if( n < size ) {
if (n+1 != size)
memmove(&nd->u.shop.shop_item[n], &nd->u.shop.shop_item[n+1], sizeof(nd->u.shop.shop_item[0])*(size-n));
memmove(&nd->u.shop.shop_item[n], &nd->u.shop.shop_item[n+1], sizeof(nd->u.shop.shop_item[0])*(size-(n + 1)));
#if PACKETVER >= 20131223
if (nd->subtype == NPCTYPE_MARKETSHOP)
npc_market_delfromsql_(nd->exname, nameid, false);