Skip to content

Commit 6e90f9a

Browse files
committed
- Fixed deallocation mismatch
1 parent f7ead2a commit 6e90f9a

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

modules/db/mysql/cmysql.cc

+5-6
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,12 @@ bool CMysql::connect()
3434

3535
bool CMysql::query(const char *stmt)
3636
{
37-
37+
3838
int ret = mysql_query(m_connection, stmt);
3939

4040
m_resultset = mysql_use_result(m_connection);
4141
if(m_resultset == NULL) {
42-
42+
4343
// TODO : Show warning message saying something is wrong
4444
// with the query?
4545
return false;
@@ -65,12 +65,11 @@ MapObject* CMysql::fetchRow()
6565
unsigned int cnt_cols = mysql_num_fields(m_resultset);
6666
unsigned long* lengths = mysql_fetch_lengths(m_resultset);
6767
MYSQL_FIELD* fields = mysql_fetch_fields(m_resultset);
68-
68+
6969
MapObject* map = new MapObject;
7070
char* str;
7171

7272
for (unsigned int i = 0; i < cnt_cols; i++) {
73-
7473
Value* value = NULL;
7574
str = new char[lengths[i]+1];
7675
snprintf(str, lengths[i]+1, "%.*s", (int)lengths[i], row[i]);
@@ -114,7 +113,7 @@ MapObject* CMysql::fetchRow()
114113
case MYSQL_TYPE_BIT:
115114
// handle as bool
116115
break;
117-
116+
118117
case MYSQL_TYPE_TINY_BLOB:
119118
case MYSQL_TYPE_MEDIUM_BLOB:
120119
case MYSQL_TYPE_LONG_BLOB:
@@ -127,7 +126,7 @@ MapObject* CMysql::fetchRow()
127126
}
128127

129128
value = NULL;
130-
delete str;
129+
delete [] str;
131130
}
132131

133132
return map;

0 commit comments

Comments
 (0)