Date: Wednesday, February 22, 2006 @ 16:55:29
Author: zsolt
Path: /cvsroot/carob/libmysequoia/src
Modified: CarobStmt.cpp (1.25 -> 1.26)
- fixed memory duplication error, when the metadata was requested for a
prepared statement.
---------------+
CarobStmt.cpp | 13 +++++++++++--
1 files changed, 11 insertions(+), 2 deletions(-)
Index: libmysequoia/src/CarobStmt.cpp
diff -u libmysequoia/src/CarobStmt.cpp:1.25 libmysequoia/src/CarobStmt.cpp:1.26
--- libmysequoia/src/CarobStmt.cpp:1.25 Wed Feb 22 15:23:57 2006
+++ libmysequoia/src/CarobStmt.cpp Wed Feb 22 16:55:29 2006
@@ -560,8 +560,17 @@
result->data = new MYSQL_DATA;
memset(result->data, 0, sizeof(MYSQL_DATA));
//duplicate fields to the dummy resultset
- result->fields = new MYSQL_FIELD[m_stmt->field_count];
- memcpy(result->fields, m_stmt->fields, m_stmt->field_count *
sizeof(MYSQL_FIELD));
+ int field_count = m_stmt->field_count;
+ result->fields = new MYSQL_FIELD[field_count];
+ memcpy(result->fields, m_stmt->fields, field_count * sizeof(MYSQL_FIELD));
+ for (MYSQL_FIELD *colPtr=result->fields; field_count; colPtr++,
field_count--)
+ {
+ colPtr->name = cstrdup(colPtr->name);
+ colPtr->org_name = cstrdup(colPtr->org_name);
+ colPtr->table = cstrdup(colPtr->table);
+ colPtr->db = cstrdup(colPtr->db);
+ colPtr->catalog = cstrdup(colPtr->catalog);
+ }
result->data->fields = result->field_count = m_stmt->field_count;
result->eof = true;
}
_______________________________________________
Carob-commits mailing list
[email protected]
https://forge.continuent.org/mailman/listinfo/carob-commits