diff options
author | UbitUmarov | 2016-08-22 06:03:39 +0100 |
---|---|---|
committer | UbitUmarov | 2016-08-22 06:03:39 +0100 |
commit | 5d5bad5fc18177d0e1369cc8127f2a1fc4323197 (patch) | |
tree | 5caae69559c40c739179c2ee6ac3f4711547a2c9 /OpenSim/Data/PGSQL/PGSQLXAssetData.cs | |
parent | workaround potencial memory leak (diff) | |
download | opensim-SC-5d5bad5fc18177d0e1369cc8127f2a1fc4323197.zip opensim-SC-5d5bad5fc18177d0e1369cc8127f2a1fc4323197.tar.gz opensim-SC-5d5bad5fc18177d0e1369cc8127f2a1fc4323197.tar.bz2 opensim-SC-5d5bad5fc18177d0e1369cc8127f2a1fc4323197.tar.xz |
workaround potencial memory leaks
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Data/PGSQL/PGSQLXAssetData.cs | 52 |
1 files changed, 27 insertions, 25 deletions
diff --git a/OpenSim/Data/PGSQL/PGSQLXAssetData.cs b/OpenSim/Data/PGSQL/PGSQLXAssetData.cs index 4f682f0..d3518cf 100644 --- a/OpenSim/Data/PGSQL/PGSQLXAssetData.cs +++ b/OpenSim/Data/PGSQL/PGSQLXAssetData.cs | |||
@@ -518,40 +518,42 @@ namespace OpenSim.Data.PGSQL | |||
518 | using (NpgsqlConnection dbcon = new NpgsqlConnection(m_connectionString)) | 518 | using (NpgsqlConnection dbcon = new NpgsqlConnection(m_connectionString)) |
519 | { | 519 | { |
520 | dbcon.Open(); | 520 | dbcon.Open(); |
521 | NpgsqlCommand cmd = new NpgsqlCommand( @"SELECT name, description, access_time, ""AssetType"", temporary, id, asset_flags, creatorid | 521 | using(NpgsqlCommand cmd = new NpgsqlCommand(@"SELECT name, description, access_time, ""AssetType"", temporary, id, asset_flags, creatorid |
522 | FROM XAssetsMeta | 522 | FROM XAssetsMeta |
523 | LIMIT :start, :count", dbcon); | 523 | LIMIT :start, :count",dbcon)) |
524 | cmd.Parameters.Add(m_database.CreateParameter("start", start)); | ||
525 | cmd.Parameters.Add(m_database.CreateParameter("count", count)); | ||
526 | |||
527 | try | ||
528 | { | 524 | { |
529 | using (NpgsqlDataReader dbReader = cmd.ExecuteReader()) | 525 | cmd.Parameters.Add(m_database.CreateParameter("start",start)); |
526 | cmd.Parameters.Add(m_database.CreateParameter("count", count)); | ||
527 | |||
528 | try | ||
530 | { | 529 | { |
531 | while (dbReader.Read()) | 530 | using (NpgsqlDataReader dbReader = cmd.ExecuteReader()) |
532 | { | 531 | { |
533 | AssetMetadata metadata = new AssetMetadata(); | 532 | while (dbReader.Read()) |
534 | metadata.Name = (string)dbReader["name"]; | 533 | { |
535 | metadata.Description = (string)dbReader["description"]; | 534 | AssetMetadata metadata = new AssetMetadata(); |
536 | metadata.Type = Convert.ToSByte(dbReader["AssetType"]); | 535 | metadata.Name = (string)dbReader["name"]; |
537 | metadata.Temporary = Convert.ToBoolean(dbReader["temporary"]); | 536 | metadata.Description = (string)dbReader["description"]; |
538 | metadata.Flags = (AssetFlags)Convert.ToInt32(dbReader["asset_flags"]); | 537 | metadata.Type = Convert.ToSByte(dbReader["AssetType"]); |
539 | metadata.FullID = DBGuid.FromDB(dbReader["id"]); | 538 | metadata.Temporary = Convert.ToBoolean(dbReader["temporary"]); |
540 | metadata.CreatorID = dbReader["creatorid"].ToString(); | 539 | metadata.Flags = (AssetFlags)Convert.ToInt32(dbReader["asset_flags"]); |
540 | metadata.FullID = DBGuid.FromDB(dbReader["id"]); | ||
541 | metadata.CreatorID = dbReader["creatorid"].ToString(); | ||
541 | 542 | ||
542 | // We'll ignore this for now - it appears unused! | 543 | // We'll ignore this for now - it appears unused! |
543 | // metadata.SHA1 = dbReader["hash"]); | 544 | // metadata.SHA1 = dbReader["hash"]); |
544 | 545 | ||
545 | UpdateAccessTime(metadata, (int)dbReader["access_time"]); | 546 | UpdateAccessTime(metadata, (int)dbReader["access_time"]); |
546 | 547 | ||
547 | retList.Add(metadata); | 548 | retList.Add(metadata); |
549 | } | ||
548 | } | 550 | } |
549 | } | 551 | } |
550 | } | 552 | catch (Exception e) |
551 | catch (Exception e) | 553 | { |
552 | { | 554 | m_log.Error("[XASSETS DB]: PGSql failure fetching asset set" + Environment.NewLine + e.ToString()); |
553 | m_log.Error("[XASSETS DB]: PGSql failure fetching asset set" + Environment.NewLine + e.ToString()); | 555 | } |
554 | } | 556 | } |
555 | } | 557 | } |
556 | } | 558 | } |
557 | 559 | ||