diff options
author | skotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2006-10-03 14:03:40 +0000 |
---|---|---|
committer | skotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2006-10-03 14:03:40 +0000 |
commit | 4c88bb6068c50726c09de5dd8f17e6e3e71fc7ed (patch) | |
tree | f900f68d95f00998f6d64c79a69351adbb05945b /src/login_sql/login.c | |
parent | 24fdc7fd359132805f403afab0d0d0dfcdfe929c (diff) | |
download | hercules-4c88bb6068c50726c09de5dd8f17e6e3e71fc7ed.tar.gz hercules-4c88bb6068c50726c09de5dd8f17e6e3e71fc7ed.tar.bz2 hercules-4c88bb6068c50726c09de5dd8f17e6e3e71fc7ed.tar.xz hercules-4c88bb6068c50726c09de5dd8f17e6e3e71fc7ed.zip |
- Fixed a possible crash and a memory leak on the login-SQL server when parsing unban requests.
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@8924 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/login_sql/login.c')
-rw-r--r-- | src/login_sql/login.c | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/src/login_sql/login.c b/src/login_sql/login.c index 5961e94a3..5527b82f4 100644 --- a/src/login_sql/login.c +++ b/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;
|