Jelajahi Sumber

- Fixed a possible crash and a memory leak on the login-SQL server when parsing unban requests.

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@8924 54d463be-8e91-2dee-dedb-b68131a5f0ec
skotlex 18 tahun lalu
induk
melakukan
782daffa9e
2 mengubah file dengan 4 tambahan dan 5 penghapusan
  1. 2 0
      Changelog-Trunk.txt
  2. 2 5
      src/login_sql/login.c

+ 2 - 0
Changelog-Trunk.txt

@@ -4,6 +4,8 @@ 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.
 
 2006/10/03
+	* Fixed a possible crash and a memory leak on the login-SQL server when
+	  parsing unban requests. [Skotlex]
 	* Renamed setting delay_dependon_dex to delay_dependon_agi, the delay of
 	  skills is reduced now (when enabled) by AGI instead of DEX, which makes a
 	  lot more sense than DEX. [Skotlex]

+ 2 - 5
src/login_sql/login.c

@@ -1306,18 +1306,15 @@ int parse_fromchar(int fd){
 					ShowDebug("at %s:%d - %s\n", __FILE__,__LINE__,tmp_sql);
 				}
 				sql_res = mysql_store_result(&mysql_handle) ;
-				if (sql_res)	{
-					sql_row = mysql_fetch_row(sql_res);	//row fetching
-				}
-				if (atol(sql_row[0]) != 0) {
+				if (sql_res && mysql_num_rows(sql_res) > 0) { //Found a match
 					sprintf(tmpsql,"UPDATE `%s` SET `ban_until` = '0' WHERE `%s` = '%d'", login_db,login_db_account_id,acc);
 					//query
 					if(mysql_query(&mysql_handle, tmpsql)) {
 						ShowSQL("DB error - %s\n",mysql_error(&mysql_handle));
 						ShowDebug("at %s:%d - %s\n", __FILE__,__LINE__,tmp_sql);
 					}
-					break;
 				}
+				if (sql_res) mysql_free_result(sql_res);
 				RFIFOSKIP(fd,6);
 			}
 			return 0;