test/blobfs: fix a couple of unit test memory leaks

In the cache_append_no_cache test case, we need to
sync the file first, before calling cache_free_buffers().
Otherwise the buffers do not really get freed since they
contain dirty data.

This fixes a couple of memory leak bugs detected with
CONFIG_ASAN=y.

Reported-by: John Meneghini <john.meneghini@netapp.com>
Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: If1ff6ed7d9e7a6dc67af0a2baf3b2555ace610ee
This commit is contained in:
Jim Harris 2017-03-31 11:32:00 -07:00
parent 5109f56ea5
commit 5490f17328

View File

@ -192,6 +192,7 @@ cache_append_no_cache(void)
CU_ASSERT(spdk_file_get_length(g_file) == 1 * sizeof(buf));
spdk_file_write(g_file, channel, buf, 1 * sizeof(buf), sizeof(buf));
CU_ASSERT(spdk_file_get_length(g_file) == 2 * sizeof(buf));
spdk_file_sync(g_file, channel);
cache_free_buffers(g_file);
spdk_file_write(g_file, channel, buf, 2 * sizeof(buf), sizeof(buf));
CU_ASSERT(spdk_file_get_length(g_file) == 3 * sizeof(buf));