mirror of
https://git.proxmox.com/git/libgit2
synced 2025-05-09 05:28:34 +00:00
Test: check restored oom error points to static buffer
This commit is contained in:
parent
0fcfb60dc4
commit
988ea59443
@ -113,22 +113,22 @@ void test_core_errors__restore(void)
|
||||
void test_core_errors__restore_oom(void)
|
||||
{
|
||||
git_error_state err_state = {0};
|
||||
const char *static_message = NULL;
|
||||
const git_error *oom_error = NULL;
|
||||
|
||||
giterr_clear();
|
||||
|
||||
giterr_set_oom(); /* internal fn */
|
||||
static_message = giterr_last()->message;
|
||||
oom_error = giterr_last();
|
||||
cl_assert(oom_error);
|
||||
|
||||
cl_assert_equal_i(-1, giterr_capture(&err_state, -1));
|
||||
|
||||
cl_assert(giterr_last() == NULL);
|
||||
|
||||
cl_assert_(err_state.error_msg.message != static_message, "pointer to static buffer exposed");
|
||||
|
||||
giterr_restore(&err_state);
|
||||
|
||||
cl_assert(giterr_last()->klass == GITERR_NOMEMORY);
|
||||
cl_assert_(giterr_last() == oom_error, "static oom error not restored");
|
||||
|
||||
giterr_clear();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user