Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/libgit2.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSascha Cunz <Sascha@BabbelBox.org>2012-11-23 14:41:56 +0400
committerSascha Cunz <Sascha@BabbelBox.org>2012-11-23 14:41:56 +0400
commit9094d30b932ca4b47dba81e76011efe05455a44a (patch)
tree117c53e9ad194d00274ad98e784318bd960c4053 /tests-clar/odb
parent5cf1b4f094eb6f724b27aa01d4f0481de2e673af (diff)
Reset all static variables to NULL in clar's __cleanup
Without this change, any failed assertion in the second (or a later) test inside a test suite has a chance of double deleting memory, resulting in a heap corruption. See #1096 for details. This leaves alone the test cases where we "just" use cl_git_sandbox_init() and cl_git_sandbox_cleanup(). These methods already take good care to not double delete a repository. Fixes #1096
Diffstat (limited to 'tests-clar/odb')
-rw-r--r--tests-clar/odb/mixed.c1
-rw-r--r--tests-clar/odb/packed.c1
-rw-r--r--tests-clar/odb/packed_one.c1
3 files changed, 3 insertions, 0 deletions
diff --git a/tests-clar/odb/mixed.c b/tests-clar/odb/mixed.c
index 0bd23e157..da0ed97d7 100644
--- a/tests-clar/odb/mixed.c
+++ b/tests-clar/odb/mixed.c
@@ -11,6 +11,7 @@ void test_odb_mixed__initialize(void)
void test_odb_mixed__cleanup(void)
{
git_odb_free(_odb);
+ _odb = NULL;
}
void test_odb_mixed__dup_oid(void) {
diff --git a/tests-clar/odb/packed.c b/tests-clar/odb/packed.c
index 4bce41ba0..90e9f3abd 100644
--- a/tests-clar/odb/packed.c
+++ b/tests-clar/odb/packed.c
@@ -12,6 +12,7 @@ void test_odb_packed__initialize(void)
void test_odb_packed__cleanup(void)
{
git_odb_free(_odb);
+ _odb = NULL;
}
void test_odb_packed__mass_read(void)
diff --git a/tests-clar/odb/packed_one.c b/tests-clar/odb/packed_one.c
index a064829dd..e9d246c23 100644
--- a/tests-clar/odb/packed_one.c
+++ b/tests-clar/odb/packed_one.c
@@ -17,6 +17,7 @@ void test_odb_packed_one__initialize(void)
void test_odb_packed_one__cleanup(void)
{
git_odb_free(_odb);
+ _odb = NULL;
}
void test_odb_packed_one__mass_read(void)