summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2018-01-20 17:59:37 +0100
committerSergei Golubchik <serg@mariadb.org>2018-01-22 11:39:54 +0100
commitf2408e7e6a39a8544b34e2407a02a084e38e49ba (patch)
tree8e0f17ea21c0cc3ca9acf30b0c8216435ce7df8e
parent36eb0b7a558542689ad654a770c3f1ce8f18dd87 (diff)
downloadmariadb-git-f2408e7e6a39a8544b34e2407a02a084e38e49ba.tar.gz
Free memory in unit tests. Makes ASAN happier.
-rw-r--r--storage/maria/unittest/ma_test_loghandler_multigroup-t.c4
-rw-r--r--storage/maria/unittest/ma_test_loghandler_nologs-t.c1
-rw-r--r--unittest/mysys/base64-t.c3
3 files changed, 7 insertions, 1 deletions
diff --git a/storage/maria/unittest/ma_test_loghandler_multigroup-t.c b/storage/maria/unittest/ma_test_loghandler_multigroup-t.c
index 56329a18d7d..779128830dc 100644
--- a/storage/maria/unittest/ma_test_loghandler_multigroup-t.c
+++ b/storage/maria/unittest/ma_test_loghandler_multigroup-t.c
@@ -234,7 +234,7 @@ int main(int argc __attribute__((unused)), char *argv[])
0x55, 0xAA, 0x55, 0xAA, 0x55, 0xAA, 0x55, 0xAA,
0x55, 0xAA, 0x55, 0xAA, 0x55, 0xAA, 0x55
};
- uchar *long_buffer= malloc(LONG_BUFFER_SIZE + LSN_STORE_SIZE * 2 + 2);
+ uchar *long_buffer;
char **default_argv;
PAGECACHE pagecache;
LSN lsn, lsn_base, first_lsn;
@@ -255,6 +255,7 @@ int main(int argc __attribute__((unused)), char *argv[])
}
#endif
+ long_buffer= malloc(LONG_BUFFER_SIZE + LSN_STORE_SIZE * 2 + 2);
load_defaults("my", load_default_groups, &argc, &argv);
get_options(&argc, &argv);
default_argv= argv;
@@ -758,6 +759,7 @@ err:
if (maria_log_remove(maria_data_root))
exit(1);
+ free(long_buffer);
return (test(exit_status()));
}
diff --git a/storage/maria/unittest/ma_test_loghandler_nologs-t.c b/storage/maria/unittest/ma_test_loghandler_nologs-t.c
index 24c93e428e1..06529066305 100644
--- a/storage/maria/unittest/ma_test_loghandler_nologs-t.c
+++ b/storage/maria/unittest/ma_test_loghandler_nologs-t.c
@@ -191,6 +191,7 @@ int main(int argc __attribute__((unused)), char *argv[])
if (maria_log_remove(maria_data_root))
exit(1);
+ free(long_buffer);
exit(0);
}
diff --git a/unittest/mysys/base64-t.c b/unittest/mysys/base64-t.c
index ed19c4de851..f4496f570f9 100644
--- a/unittest/mysys/base64-t.c
+++ b/unittest/mysys/base64-t.c
@@ -91,6 +91,9 @@ main(int argc __attribute__((unused)),char *argv[])
diag("src length: %.8x, dst length: %.8x\n",
(uint) src_len, (uint) dst_len);
}
+ free(dst);
+ free(str);
+ free(src);
}
my_end(0);
return exit_status();