Преглед изворни кода

Fixed Sql object not initializing default values properly.
Fixed Sql_Free producing timer deallocation errors when called without first establishing a database connection.

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@13011 54d463be-8e91-2dee-dedb-b68131a5f0ec

ultramage пре 17 година
родитељ
комит
6fd34c5052
2 измењених фајлова са 9 додато и 1 уклоњено
  1. 3 0
      Changelog-Trunk.txt
  2. 6 1
      src/common/sql.c

+ 3 - 0
Changelog-Trunk.txt

@@ -4,6 +4,9 @@ AS OF SVN REV. 5091, WE ARE NOW USING TRUNK.  ALL UNTESTED BUGFIXES/FEATURES GO
 IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
 
 2008/07/29
+	* Fixed Sql object not initializing default values properly.
+	  Fixed Sql_Free producing timer deallocation errors when called
+	  without first establishing a database connection.
 	* Corrected upgrade_svn12975_view.sql not assigning default values
 	  to the two dummy columns; please drop the view and re-run the script.
 2008/07/27

+ 6 - 1
src/common/sql.c

@@ -67,9 +67,14 @@ struct SqlStmt
 Sql* Sql_Malloc(void)
 {
 	Sql* self;
+
 	CREATE(self, Sql, 1);
 	mysql_init(&self->handle);
 	StringBuf_Init(&self->buf);
+	self->lengths = NULL;
+	self->result = NULL;
+	self->keepalive = INVALID_TIMER;
+
 	return self;
 }
 
@@ -406,7 +411,7 @@ void Sql_Free(Sql* self)
 	{
 		Sql_FreeResult(self);
 		StringBuf_Destroy(&self->buf);
-		delete_timer(self->keepalive, Sql_P_KeepaliveTimer);
+		if( self->keepalive != INVALID_TIMER ) delete_timer(self->keepalive, Sql_P_KeepaliveTimer);
 		aFree(self);
 	}
 }