mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Fix up double-frees or frees of unallocated objects in KVP.
Revealed by ensuring that KvpFrame and KvpValue deep-destroy their contents.
This commit is contained in:
parent
919fe76c95
commit
ca62782d93
@ -109,7 +109,7 @@ setup_memory (Fixture *fixture, gconstpointer pData)
|
||||
|
||||
frame->set("string-val", new KvpValue("abcdefghijklmnop"));
|
||||
auto guid = qof_instance_get_guid (QOF_INSTANCE(acct1));
|
||||
frame->set("guid-val", new KvpValue(const_cast<GncGUID*>(guid)));
|
||||
frame->set("guid-val", new KvpValue(const_cast<GncGUID*>(guid_copy(guid))));
|
||||
|
||||
gnc_account_append_child (root, acct1);
|
||||
|
||||
|
@ -120,7 +120,6 @@ test_kvp_frames1(void)
|
||||
test_kvp_copy_compare(i, test_frame1, test_val1, test_key);
|
||||
test_kvp_copy_get_slot(i, test_frame1, test_val1, test_key);
|
||||
|
||||
delete test_val1;
|
||||
g_free(test_key);
|
||||
delete test_frame1;
|
||||
}
|
||||
|
@ -2051,7 +2051,7 @@ xaccSplitAddPeerSplit (Split *split, const Split *other_split,
|
||||
guid = qof_instance_get_guid (QOF_INSTANCE (other_split));
|
||||
xaccTransBeginEdit (split->parent);
|
||||
qof_instance_kvp_add_guid (QOF_INSTANCE (split), "lot-split",
|
||||
timespec_now(), "peer_guid", guid);
|
||||
timespec_now(), "peer_guid", guid_copy(guid));
|
||||
mark_split (split);
|
||||
qof_instance_set_dirty (QOF_INSTANCE (split));
|
||||
xaccTransCommitEdit (split->parent);
|
||||
|
@ -319,7 +319,7 @@ test_xaccDupeSplit (Fixture *fixture, gconstpointer pData)
|
||||
}
|
||||
/* xaccSplitCloneNoKvp
|
||||
Split *
|
||||
xaccSplitCloneNoKvp (const Split *s)// C: 1
|
||||
xaccSplitCloneNoKvp (const Split *s)// C: 1
|
||||
*/
|
||||
static void
|
||||
test_xaccSplitCloneNoKvp (Fixture *fixture, gconstpointer pData)
|
||||
@ -743,7 +743,7 @@ test_xaccSplitDetermineGainStatus (Fixture *fixture, gconstpointer pData)
|
||||
g_assert (fixture->split->gains_split == NULL);
|
||||
g_assert_cmpint (fixture->split->gains, ==, GAINS_STATUS_A_VDIRTY | GAINS_STATUS_DATE_DIRTY);
|
||||
|
||||
fixture->split->inst.kvp_data->set("gains-source", new KvpValue(const_cast<GncGUID*>(g_guid)));
|
||||
fixture->split->inst.kvp_data->set("gains-source", new KvpValue(const_cast<GncGUID*>(guid_copy(g_guid))));
|
||||
g_assert (fixture->split->gains_split == NULL);
|
||||
fixture->split->gains = GAINS_STATUS_UNKNOWN;
|
||||
xaccSplitDetermineGainStatus (fixture->split);
|
||||
|
@ -179,6 +179,7 @@ TEST_F (KvpFrameTest, GetSlotPath)
|
||||
EXPECT_EQ (nullptr, t_root.set(path2, v2));
|
||||
EXPECT_EQ (v1, t_root.get_slot(path1));
|
||||
EXPECT_EQ (nullptr, t_root.get_slot(path2));
|
||||
t_root.set_path(path1, nullptr);
|
||||
t_root.set_path(path3, v1);
|
||||
EXPECT_EQ (v1, t_root.get_slot(path3a));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user