diff options
author | Anubisss <none@none> | 2010-01-23 14:45:58 +0100 |
---|---|---|
committer | Anubisss <none@none> | 2010-01-23 14:45:58 +0100 |
commit | d9cb0702158fd045285f2c0a904cb31a45a3864a (patch) | |
tree | cdc6a7c6a83c6eea603ae296a653fb9f04945aad /src/shared/Database/DBCStore.h | |
parent | c784110d87666579f18620a98e1e57118db4a9cf (diff) |
Implement QueryResult_AutoPtr type which is ACE's reference counted auto_ptr(ACE_Refcounted_Auto_Ptr) for QueryResult pointers.
Use this auto_ptr for every DB queries(except QueryNamedResult yet).
This patch guarantees NO memory leaks from QueryResult pointers.
Thanks to raczman for the idea and for the helping to make this patch.
--HG--
branch : trunk
Diffstat (limited to 'src/shared/Database/DBCStore.h')
-rw-r--r-- | src/shared/Database/DBCStore.h | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/src/shared/Database/DBCStore.h b/src/shared/Database/DBCStore.h index ea4ce109e27..4344b6e6450 100644 --- a/src/shared/Database/DBCStore.h +++ b/src/shared/Database/DBCStore.h @@ -83,7 +83,7 @@ class DBCStorage uint32 sqlRecordCount = 0; uint32 sqlHighestIndex = 0; Field *fields = NULL; - QueryResult *result = NULL; + QueryResult_AutoPtr result = QueryResult_AutoPtr(NULL); // Load data from sql if (sql) { @@ -188,7 +188,6 @@ class DBCStorage break; case FT_STRING: sLog.outError("Unsupported data type in table '%s' at char %d", sql->sqlTableName.c_str(), columnNumber); - delete result; return false; case FT_SORT: break; @@ -201,14 +200,12 @@ class DBCStorage else { sLog.outError("Incorrect sql format string '%s' at char %d", sql->sqlTableName.c_str(), columnNumber); - delete result; return false; } } if (sqlColumnNumber != (result->GetFieldCount()-1)) { sLog.outError("SQL and DBC format strings are not matching for table: '%s'", sql->sqlTableName.c_str()); - delete result; return false; } @@ -216,7 +213,6 @@ class DBCStorage ++rowIndex; }while (result->NextRow()); } - delete result; } // error in dbc file at loading if NULL |