mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Fix the most serious backend memory leaks.
This commit is contained in:
parent
1883d8ec31
commit
43df1ccc3a
@ -244,6 +244,7 @@ GncSqlBillTermBackend::load_all (GncSqlBackend* sql_be)
|
|||||||
if (pBillTerm != nullptr)
|
if (pBillTerm != nullptr)
|
||||||
instances.push_back(QOF_INSTANCE(pBillTerm));
|
instances.push_back(QOF_INSTANCE(pBillTerm));
|
||||||
}
|
}
|
||||||
|
delete result;
|
||||||
|
|
||||||
if (!instances.empty())
|
if (!instances.empty())
|
||||||
gnc_sql_slots_load_for_instancevec (sql_be, instances);
|
gnc_sql_slots_load_for_instancevec (sql_be, instances);
|
||||||
|
@ -361,9 +361,9 @@ set_string_val (gpointer pObject, gpointer pValue)
|
|||||||
|
|
||||||
if (pInfo->value_type != KvpValue::Type::STRING || pValue == NULL)
|
if (pInfo->value_type != KvpValue::Type::STRING || pValue == NULL)
|
||||||
return;
|
return;
|
||||||
auto string = g_strdup (static_cast<const char*> (pValue));
|
auto value = new KvpValue {static_cast<const char*> (pValue)};
|
||||||
auto value = new KvpValue {string};
|
|
||||||
set_slot_from_value (pInfo, value);
|
set_slot_from_value (pInfo, value);
|
||||||
|
delete value;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gpointer
|
static gpointer
|
||||||
@ -796,6 +796,7 @@ slots_load_info (slot_info_t* pInfo)
|
|||||||
auto result = pInfo->be->execute_select_statement (stmt);
|
auto result = pInfo->be->execute_select_statement (stmt);
|
||||||
for (auto row : *result)
|
for (auto row : *result)
|
||||||
load_slot (pInfo, row);
|
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);
|
auto result = sql_be->execute_select_statement(stmt);
|
||||||
for (auto row : *result)
|
for (auto row : *result)
|
||||||
load_slot_for_book_object (sql_be, row, lookup_fn);
|
load_slot_for_book_object (sql_be, row, lookup_fn);
|
||||||
|
delete result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ================================================================= */
|
/* ================================================================= */
|
||||||
|
@ -549,6 +549,7 @@ GncSqlColumnTableEntryImpl<CT_NUMERIC>::load (const GncSqlBackend* sql_be,
|
|||||||
buf = g_strdup_printf ("%s_denom", m_col_name);
|
buf = g_strdup_printf ("%s_denom", m_col_name);
|
||||||
auto denom = row.get_int_at_col (buf);
|
auto denom = row.get_int_at_col (buf);
|
||||||
n = gnc_numeric_create (num, denom);
|
n = gnc_numeric_create (num, denom);
|
||||||
|
g_free (buf);
|
||||||
}
|
}
|
||||||
catch (std::invalid_argument)
|
catch (std::invalid_argument)
|
||||||
{
|
{
|
||||||
@ -569,6 +570,7 @@ GncSqlColumnTableEntryImpl<CT_NUMERIC>::add_to_table(ColVec& vec) const noexcept
|
|||||||
subtable_row->m_col_name);
|
subtable_row->m_col_name);
|
||||||
GncSqlColumnInfo info(buf, BCT_INT64, 0, false, false,
|
GncSqlColumnInfo info(buf, BCT_INT64, 0, false, false,
|
||||||
m_flags & COL_PKEY, m_flags & COL_NNUL);
|
m_flags & COL_PKEY, m_flags & COL_NNUL);
|
||||||
|
g_free (buf);
|
||||||
vec.emplace_back(std::move(info));
|
vec.emplace_back(std::move(info));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user