Commit 3ff55c65 authored by Jacek Kalwas's avatar Jacek Kalwas Committed by Konrad Sztyber
Browse files

event: fix double free on app stop



App stop can be called multiple times and there is a flag to protect
against that however free of the json data was the very first thing to
be done hence chance for double free there. Fix by moving free after the
flag checked.

Change-Id: I85057e556c28dafb82883d80899fcc71bb2f9802
Signed-off-by: default avatarJacek Kalwas <jacek.kalwas@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/24725


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarKonrad Sztyber <konrad.sztyber@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: default avatarJim Harris <jim.harris@samsung.com>
parent 496d6e76
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -1031,8 +1031,6 @@ log_deprecation_hits(void *ctx, struct spdk_deprecation *dep)
static void
app_stop(void *arg1)
{
	free(g_spdk_app.json_data);

	if (g_spdk_app.rc == 0) {
		g_spdk_app.rc = (int)(intptr_t)arg1;
	}
@@ -1042,6 +1040,8 @@ app_stop(void *arg1)
		return;
	}

	free(g_spdk_app.json_data);

	g_spdk_app.stopped = true;
	spdk_log_for_each_deprecation(NULL, log_deprecation_hits);
	_start_subsystem_fini(NULL);