summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--server/tests/check_and_open-tests.c6
-rw-r--r--server/tests/krb5_utils-tests.c1
2 files changed, 6 insertions, 1 deletions
diff --git a/server/tests/check_and_open-tests.c b/server/tests/check_and_open-tests.c
index 2e964557..b0d638b5 100644
--- a/server/tests/check_and_open-tests.c
+++ b/server/tests/check_and_open-tests.c
@@ -32,7 +32,8 @@
#define SUFFIX ".symlink"
-char filename[] = "check_and_open-tests-XXXXXX";
+#define FILENAME_TEMPLATE "check_and_open-tests-XXXXXX"
+char *filename;
uid_t uid;
gid_t gid;
mode_t mode;
@@ -42,6 +43,8 @@ void setup_check_and_open(void)
{
int ret;
+ filename = strdup(FILENAME_TEMPLATE);
+ fail_unless(filename != NULL, "strdup failed");
ret = mkstemp(filename);
fail_unless(ret != -1, "mkstemp failed [%d][%s]", errno, strerror(errno));
close(ret);
@@ -63,6 +66,7 @@ void teardown_check_and_open(void)
fail_unless(filename != NULL, "unknown filename");
ret = unlink(filename);
+ free(filename);
fail_unless(ret == 0, "unlink failed [%d][%s]", errno, strerror(errno));
}
diff --git a/server/tests/krb5_utils-tests.c b/server/tests/krb5_utils-tests.c
index c3d9f4cf..8676f3bf 100644
--- a/server/tests/krb5_utils-tests.c
+++ b/server/tests/krb5_utils-tests.c
@@ -92,6 +92,7 @@ void free_talloc_context(void)
int ret;
fail_unless(tmp_ctx != NULL, "Talloc context already freed.");
ret = talloc_free(tmp_ctx);
+ tmp_ctx = NULL;
fail_unless(ret == 0, "Connot free talloc context.");
}