diff options
author | ultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2008-07-29 07:59:27 +0000 |
---|---|---|
committer | ultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2008-07-29 07:59:27 +0000 |
commit | b91483219d36a4fb7359a5fdc17cedaf73b18dc5 (patch) | |
tree | cda497d3af9166aa32baa47b4bf42a90dc8507c9 /src/common/sql.c | |
parent | c46cdaae3ea8ce0a0128a59e79a03f0c7f5b3e12 (diff) | |
download | hercules-b91483219d36a4fb7359a5fdc17cedaf73b18dc5.tar.gz hercules-b91483219d36a4fb7359a5fdc17cedaf73b18dc5.tar.bz2 hercules-b91483219d36a4fb7359a5fdc17cedaf73b18dc5.tar.xz hercules-b91483219d36a4fb7359a5fdc17cedaf73b18dc5.zip |
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://rathena.svn.sourceforge.net/svnroot/rathena/trunk@13011 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/common/sql.c')
-rw-r--r-- | src/common/sql.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/common/sql.c b/src/common/sql.c index 47ff320ea..0e8e7c2ae 100644 --- a/src/common/sql.c +++ b/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); } } |