event: fix null pointer issue in spdk_subsystem_fini

The variable cur could be null, so if we use do while
will cause a segment fault

Change-Id: I19ec26e88948a0c3fd957e03e717b68750f40c62
Signed-off-by: Ziye Yang <ziye.yang@intel.com>
This commit is contained in:
Ziye Yang 2016-06-14 15:19:38 +08:00 committed by Jim Harris
parent 5603ff07b9
commit e87e3df674

View File

@ -149,14 +149,16 @@ spdk_subsystem_fini(void)
struct spdk_subsystem *cur;
cur = TAILQ_LAST(&g_subsystems, spdk_subsystem_list);
do {
while (cur) {
if (cur->fini) {
rc = cur->fini();
if (rc)
return rc;
}
cur = TAILQ_PREV(cur, spdk_subsystem_list, tailq);
} while (cur);
}
return rc;
}