diff --git a/Horion/Command/Commands/GiveCommand.cpp b/Horion/Command/Commands/GiveCommand.cpp index 34a7e1ad8..f4f1350e8 100644 --- a/Horion/Command/Commands/GiveCommand.cpp +++ b/Horion/Command/Commands/GiveCommand.cpp @@ -27,26 +27,23 @@ bool GiveCommand::execute(std::vector* args) { auto transactionManager = g_Data.getLocalPlayer()->getTransactionManager(); if (itemId == 0) { - void* ItemPtr = malloc(0x8); - void* idk = malloc(0x0); TextHolder tempText(args->at(1)); - C_Item*** cStack = ItemRegistry::lookUpByName(ItemPtr, idk, tempText); + std::unique_ptr ItemPtr = std::make_unique(); + std::unique_ptr buffer = std::make_unique(); + C_Item*** cStack = ItemRegistry::lookUpByName(ItemPtr.get(), buffer.get(), tempText); if (*cStack == nullptr) { clientMessageF("%sInvalid item name!", RED); return true; } yot = new C_ItemStack(***cStack, count, itemData); - free(ItemPtr); - free(idk); } else { - void* ItemPtr = malloc(0x8); - C_Item*** cStack = ItemRegistry::getItemFromId(ItemPtr, itemId); + std::unique_ptr ItemPtr = std::make_unique(); + C_Item*** cStack = ItemRegistry::getItemFromId(ItemPtr.get(), itemId); if (cStack == nullptr || *cStack == nullptr || **cStack == nullptr) { clientMessageF("%sInvalid item ID!", RED); return true; } yot = new C_ItemStack(***cStack, count, itemData); - free(ItemPtr); } if (yot != nullptr)