aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Data/MySQL/MySQLXAssetData.cs
diff options
context:
space:
mode:
authorUbitUmarov2016-08-22 06:03:39 +0100
committerUbitUmarov2016-08-22 06:03:39 +0100
commit5d5bad5fc18177d0e1369cc8127f2a1fc4323197 (patch)
tree5caae69559c40c739179c2ee6ac3f4711547a2c9 /OpenSim/Data/MySQL/MySQLXAssetData.cs
parentworkaround potencial memory leak (diff)
downloadopensim-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 'OpenSim/Data/MySQL/MySQLXAssetData.cs')
-rw-r--r--OpenSim/Data/MySQL/MySQLXAssetData.cs48
1 files changed, 25 insertions, 23 deletions
diff --git a/OpenSim/Data/MySQL/MySQLXAssetData.cs b/OpenSim/Data/MySQL/MySQLXAssetData.cs
index 68e1a5a..ec2bcc6 100644
--- a/OpenSim/Data/MySQL/MySQLXAssetData.cs
+++ b/OpenSim/Data/MySQL/MySQLXAssetData.cs
@@ -440,37 +440,39 @@ namespace OpenSim.Data.MySQL
440 using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) 440 using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
441 { 441 {
442 dbcon.Open(); 442 dbcon.Open();
443 MySqlCommand cmd = new MySqlCommand("SELECT Name, Description, AccessTime, AssetType, Temporary, ID, AssetFlags, CreatorID FROM XAssetsMeta LIMIT ?start, ?count", dbcon); 443 using(MySqlCommand cmd = new MySqlCommand("SELECT Name, Description, AccessTime, AssetType, Temporary, ID, AssetFlags, CreatorID FROM XAssetsMeta LIMIT ?start, ?count",dbcon))
444 cmd.Parameters.AddWithValue("?start", start);
445 cmd.Parameters.AddWithValue("?count", count);
446
447 try
448 { 444 {
449 using (MySqlDataReader dbReader = cmd.ExecuteReader()) 445 cmd.Parameters.AddWithValue("?start",start);
446 cmd.Parameters.AddWithValue("?count", count);
447
448 try
450 { 449 {
451 while (dbReader.Read()) 450 using (MySqlDataReader dbReader = cmd.ExecuteReader())
452 { 451 {
453 AssetMetadata metadata = new AssetMetadata(); 452 while (dbReader.Read())
454 metadata.Name = (string)dbReader["Name"]; 453 {
455 metadata.Description = (string)dbReader["Description"]; 454 AssetMetadata metadata = new AssetMetadata();
456 metadata.Type = (sbyte)dbReader["AssetType"]; 455 metadata.Name = (string)dbReader["Name"];
457 metadata.Temporary = Convert.ToBoolean(dbReader["Temporary"]); // Not sure if this is correct. 456 metadata.Description = (string)dbReader["Description"];
458 metadata.Flags = (AssetFlags)Convert.ToInt32(dbReader["AssetFlags"]); 457 metadata.Type = (sbyte)dbReader["AssetType"];
459 metadata.FullID = DBGuid.FromDB(dbReader["ID"]); 458 metadata.Temporary = Convert.ToBoolean(dbReader["Temporary"]); // Not sure if this is correct.
460 metadata.CreatorID = dbReader["CreatorID"].ToString(); 459 metadata.Flags = (AssetFlags)Convert.ToInt32(dbReader["AssetFlags"]);
460 metadata.FullID = DBGuid.FromDB(dbReader["ID"]);
461 metadata.CreatorID = dbReader["CreatorID"].ToString();
461 462
462 // We'll ignore this for now - it appears unused! 463 // We'll ignore this for now - it appears unused!
463// metadata.SHA1 = dbReader["hash"]); 464 // metadata.SHA1 = dbReader["hash"]);
464 465
465 UpdateAccessTime(metadata, (int)dbReader["AccessTime"]); 466 UpdateAccessTime(metadata, (int)dbReader["AccessTime"]);
466 467
467 retList.Add(metadata); 468 retList.Add(metadata);
469 }
468 } 470 }
469 } 471 }
470 } 472 catch (Exception e)
471 catch (Exception e) 473 {
472 { 474 m_log.Error("[XASSETS DB]: MySql failure fetching asset set" + Environment.NewLine + e.ToString());
473 m_log.Error("[XASSETS DB]: MySql failure fetching asset set" + Environment.NewLine + e.ToString()); 475 }
474 } 476 }
475 } 477 }
476 478