Fix the most serious backend memory leaks.

This commit is contained in:
John Ralls 2017-08-14 13:47:05 +03:00
parent 1883d8ec31
commit 43df1ccc3a
3 changed files with 7 additions and 2 deletions

View File

@ -244,6 +244,7 @@ GncSqlBillTermBackend::load_all (GncSqlBackend* sql_be)
if (pBillTerm != nullptr)
instances.push_back(QOF_INSTANCE(pBillTerm));
}
delete result;
if (!instances.empty())
gnc_sql_slots_load_for_instancevec (sql_be, instances);

View File

@ -361,9 +361,9 @@ set_string_val (gpointer pObject, gpointer pValue)
if (pInfo->value_type != KvpValue::Type::STRING || pValue == NULL)
return;
auto string = g_strdup (static_cast<const char*> (pValue));
auto value = new KvpValue {string};
auto value = new KvpValue {static_cast<const char*> (pValue)};
set_slot_from_value (pInfo, value);
delete value;
}
static gpointer
@ -796,6 +796,7 @@ slots_load_info (slot_info_t* pInfo)
auto result = pInfo->be->execute_select_statement (stmt);
for (auto row : *result)
load_slot (pInfo, row);
delete result;
}
}
@ -934,6 +935,7 @@ void gnc_sql_slots_load_for_sql_subquery (GncSqlBackend* sql_be,
auto result = sql_be->execute_select_statement(stmt);
for (auto row : *result)
load_slot_for_book_object (sql_be, row, lookup_fn);
delete result;
}
/* ================================================================= */

View File

@ -549,6 +549,7 @@ GncSqlColumnTableEntryImpl<CT_NUMERIC>::load (const GncSqlBackend* sql_be,
buf = g_strdup_printf ("%s_denom", m_col_name);
auto denom = row.get_int_at_col (buf);
n = gnc_numeric_create (num, denom);
g_free (buf);
}
catch (std::invalid_argument)
{
@ -569,6 +570,7 @@ GncSqlColumnTableEntryImpl<CT_NUMERIC>::add_to_table(ColVec& vec) const noexcept
subtable_row->m_col_name);
GncSqlColumnInfo info(buf, BCT_INT64, 0, false, false,
m_flags & COL_PKEY, m_flags & COL_NNUL);
g_free (buf);
vec.emplace_back(std::move(info));
}
}