Skip to content
Snippets Groups Projects
Commit 7d7ce942 authored by Steven Murray's avatar Steven Murray
Browse files

Fixed memory leak that was failing the valgrind unit-tests

parent ddcee707
No related branches found
No related tags found
No related merge requests found
......@@ -170,18 +170,9 @@ void SqliteRset::populateColNameToIdxMap() {
//------------------------------------------------------------------------------
// columnText
//------------------------------------------------------------------------------
char *SqliteRset::columnText(const char *const colName) const {
const char *SqliteRset::columnText(const char *const colName) const {
const int colIdx = (*m_colNameToIdx)[colName];
const char *const text = (const char *)sqlite3_column_text(m_stmt.get(), colIdx);
if(NULL == text) {
return NULL;
} else {
const size_t strLen = std::strlen(text);
char *const str = new char[strLen + 1];
std::memcpy(str, text, strLen);
str[strLen] = '\0';
return str;
}
return (const char *)sqlite3_column_text(m_stmt.get(), colIdx);
}
//------------------------------------------------------------------------------
......
......@@ -79,7 +79,7 @@ public:
* responsibility of the caller to free the memory associated with the string
* using delete[] operator.
*/
char *columnText(const char *const colName) const;
const char *columnText(const char *const colName) const;
/**
* Returns the value of the specified column as an integer.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment