nvme/overhead: fix segfault when no SSD found

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I862a7eb89d6357c85285d2a6cd90ad9f633d2435

Reviewed-on: https://review.gerrithub.io/413285
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
This commit is contained in:
Jim Harris 2018-06-01 07:17:34 -07:00 committed by Changpeng Liu
parent 13ed998697
commit 269a479064

View File

@ -683,9 +683,11 @@ int main(int argc, char **argv)
print_stats();
cleanup:
spdk_histogram_data_free(g_ns->submit_histogram);
spdk_histogram_data_free(g_ns->complete_histogram);
free(g_ns);
if (g_ns) {
spdk_histogram_data_free(g_ns->submit_histogram);
spdk_histogram_data_free(g_ns->complete_histogram);
free(g_ns);
}
if (g_ctrlr) {
spdk_nvme_detach(g_ctrlr->ctrlr);
free(g_ctrlr);