Go Back   EQEmulator Home > EQEmulator Forums > Archives > Archive::Support > Archive::Linux Servers

Archive::Linux Servers Archive area for Linux Servers's posts that were moved here after an inactivity period of 90 days.

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #34  
Old 11-20-2003, 02:38 AM
Trumpcard
Demi-God
 
Join Date: Jan 2002
Location: Charlotte, NC
Posts: 2,614
Default

Theres one too fix..


Code:
if (RunQuery(query, MakeAnyLenString(&query, "SELECT loottable_id, lootdrop_id, multiplier, probability FROM loottable_entries WHERE loottable_id=%i", tmpid), errbuf, &result2)) {
				safe_delete_array(query);
				tmpLT = (LootTable_Struct*) new uchar[sizeof(LootTable_Struct) + (sizeof(LootTableEntries_Struct) * mysql_num_rows(result2))];
				memset(tmpLT, 0, sizeof(LootTable_Struct) + (sizeof(LootTableEntries_Struct) * mysql_num_rows(result2)));
				tmpLT->NumEntries = mysql_num_rows(result2);
				tmpLT->mincash = tmpmincash;
				tmpLT->maxcash = tmpmaxcash;
				tmpLT->avgcoin = tmpavgcoin;
				i=0;
				while ((row = mysql_fetch_row(result2))) {
					if (i >= tmpLT->NumEntries) {
						mysql_free_result(result);
						mysql_free_result(result2);
						cerr << "Error in Database::DBLoadLoot, i >= NumEntries" << endl;
						return false;
					}
					tmpLT->Entries[i].lootdrop_id = atoi(row[1]);
					tmpLT->Entries[i].multiplier = atoi(row[2]);
					tmpLT->Entries[i].probability = atoi(row[3]);
					i++;
				}
				if (!EMuShareMemDLL.Loot.cbAddLootTable(tmpid, tmpLT)) {
					mysql_free_result(result);
					mysql_free_result(result2);
					safe_delete(tmpLT);
					cout << "Error in Database::DBLoadLoot: !cbAddLootTable(" << tmpid << ")" << endl;
					return false;
				}
				safe_delete(tmpLT);
				mysql_free_result(result2);
The problem is here..

tmpLT = (LootTable_Struct*) new uchar[sizeof(LootTable_Struct) + (sizeof(LootTableEntries_Struct) * mysql_num_rows(result2))];

and its dealloc'd with

safe_delete(tmpLT);


That delete should be a safe_delete_array since it's new'd as uchar[x]



The one in seperator confuses me.. This is the deconstructor

91 ~Seperator() {
92 for (int i=0; i<=maxargnum; i++)
93 safe_delete(arg[i]);
94 safe_delete_array(arg);
95 safe_delete_array(argplus);
96 }


If you have an array of new'd objects, do you need to delete each member of the array, do you need to dealloc each member of the array, and then the array itself ?
__________________
Quitters never win, and winners never quit, but those who never win and never quit are idiots.
Reply With Quote
 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

   

All times are GMT -4. The time now is 05:10 AM.


 

Everquest is a registered trademark of Daybreak Game Company LLC.
EQEmulator is not associated or affiliated in any way with Daybreak Game Company LLC.
Except where otherwise noted, this site is licensed under a Creative Commons License.
       
Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3