Commit 5490f173 authored by Jim Harris's avatar Jim Harris
Browse files

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: default avatarJohn Meneghini <john.meneghini@netapp.com>
Signed-off-by: default avatarJim Harris <james.r.harris@intel.com>
Change-Id: If1ff6ed7d9e7a6dc67af0a2baf3b2555ace610ee
parent 5109f56e
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -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));