浏览代码

Fixed chrif_authreq possible crash, bugreport:5337

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@15595 54d463be-8e91-2dee-dedb-b68131a5f0ec
shennetsind 13 年之前
父节点
当前提交
2856e2f729
共有 1 个文件被更改,包括 4 次插入7 次删除
  1. 4 7
      src/map/chrif.c

+ 4 - 7
src/map/chrif.c

@@ -275,8 +275,7 @@ int chrif_save(struct map_session_data *sd, int flag)
 			ShowError("chrif_save: Failed to set up player %d:%d for proper quitting!\n", sd->status.account_id, sd->status.char_id);
 	}
 
-	if(!chrif_isconnected())
-		return -1; //Character is saved on reconnect.
+	chrif_check(-1); //Character is saved on reconnect.
 
 	//For data sync
 	if (sd->state.storage_flag == 2)
@@ -552,8 +551,7 @@ void chrif_authreq(struct map_session_data *sd)
 {
 	struct auth_node *node= chrif_search(sd->bl.id);
 
-	if( node != NULL )
-	{
+	if( node != NULL || !chrif_isconnected() ) {
 		set_eof(sd->fd);
 		return;
 	}
@@ -692,9 +690,8 @@ int auth_db_cleanup_sub(DBKey key,void *data,va_list ap)
 	return 0;
 }
 
-int auth_db_cleanup(int tid, unsigned int tick, int id, intptr_t data)
-{
-	if(!chrif_isconnected()) return 0;
+int auth_db_cleanup(int tid, unsigned int tick, int id, intptr_t data) {
+	chrif_check(0);
 	auth_db->foreach(auth_db, auth_db_cleanup_sub);
 	return 0;
 }