Commit 19d5c3ed authored by Changpeng Liu's avatar Changpeng Liu Committed by Tomasz Zawadzki
Browse files

rocksdb: free existing channel when allocating a new channel



ASAN will report memory leak if we didn't free the old thread context,
it's related with Rocksdb version, I didn't get this issue with Rocksdb
v5.6, but Rocksdb v5.14 and v5.18 will complain the memory leak.

Change-Id: I116cad6c1bc723a60284a5c7cf1e78d10efa9ddd
Signed-off-by: default avatarChangpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/666


Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Reviewed-by: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
parent 8e7d6e1b
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -643,6 +643,9 @@ void SpdkInitializeThread(void)
	struct spdk_thread *thread;

	if (g_fs != NULL) {
		if (g_sync_args.channel) {
			spdk_fs_free_thread_ctx(g_sync_args.channel);
		}
		thread = spdk_thread_create("spdk_rocksdb", NULL);
		spdk_set_thread(thread);
		g_sync_args.channel = spdk_fs_alloc_thread_ctx(g_fs);