Skip to content

Commit f2408e7

Browse files
committed
Free memory in unit tests. Makes ASAN happier.
1 parent 36eb0b7 commit f2408e7

File tree

3 files changed

+7
-1
lines changed

3 files changed

+7
-1
lines changed

storage/maria/unittest/ma_test_loghandler_multigroup-t.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ int main(int argc __attribute__((unused)), char *argv[])
234234
0x55, 0xAA, 0x55, 0xAA, 0x55, 0xAA, 0x55, 0xAA,
235235
0x55, 0xAA, 0x55, 0xAA, 0x55, 0xAA, 0x55
236236
};
237-
uchar *long_buffer= malloc(LONG_BUFFER_SIZE + LSN_STORE_SIZE * 2 + 2);
237+
uchar *long_buffer;
238238
char **default_argv;
239239
PAGECACHE pagecache;
240240
LSN lsn, lsn_base, first_lsn;
@@ -255,6 +255,7 @@ int main(int argc __attribute__((unused)), char *argv[])
255255
}
256256
#endif
257257

258+
long_buffer= malloc(LONG_BUFFER_SIZE + LSN_STORE_SIZE * 2 + 2);
258259
load_defaults("my", load_default_groups, &argc, &argv);
259260
get_options(&argc, &argv);
260261
default_argv= argv;
@@ -758,6 +759,7 @@ int main(int argc __attribute__((unused)), char *argv[])
758759
if (maria_log_remove(maria_data_root))
759760
exit(1);
760761

762+
free(long_buffer);
761763
return (test(exit_status()));
762764
}
763765

storage/maria/unittest/ma_test_loghandler_nologs-t.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,7 @@ int main(int argc __attribute__((unused)), char *argv[])
191191

192192
if (maria_log_remove(maria_data_root))
193193
exit(1);
194+
free(long_buffer);
194195
exit(0);
195196
}
196197

unittest/mysys/base64-t.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,9 @@ main(int argc __attribute__((unused)),char *argv[])
9191
diag("src length: %.8x, dst length: %.8x\n",
9292
(uint) src_len, (uint) dst_len);
9393
}
94+
free(dst);
95+
free(str);
96+
free(src);
9497
}
9598
my_end(0);
9699
return exit_status();

0 commit comments

Comments
 (0)