Commit 929fb087 authored by GangCao's avatar GangCao Committed by Daniel Verkamp
Browse files

free allocated spdk_conf in case of failure



Change-Id: I1c7b1ea12e535da83fc47f449ccb6fb02a231047
Signed-off-by: default avatarGangCao <gang.cao@intel.com>
parent 042452af
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -257,10 +257,12 @@ spdk_app_init(struct spdk_app_opts *opts)
		rc = spdk_conf_read(config, opts->config_file);
		if (rc != 0) {
			fprintf(stderr, "Could not read config file %s\n", opts->config_file);
			spdk_conf_free(config);
			exit(EXIT_FAILURE);
		}
		if (spdk_conf_first_section(config) == NULL) {
			fprintf(stderr, "Invalid config file %s\n", opts->config_file);
			spdk_conf_free(config);
			exit(EXIT_FAILURE);
		}
	}
@@ -331,6 +333,7 @@ spdk_app_init(struct spdk_app_opts *opts)
	 */
	if (spdk_reactors_init(opts->reactor_mask, opts->max_delay_us)) {
		fprintf(stderr, "Invalid reactor mask.\n");
		spdk_conf_free(g_spdk_app.config);
		exit(EXIT_FAILURE);
	}

@@ -343,6 +346,7 @@ spdk_app_init(struct spdk_app_opts *opts)
	rc = sigaction(SIGPIPE, &sigact, NULL);
	if (rc < 0) {
		SPDK_ERRLOG("sigaction(SIGPIPE) failed\n");
		spdk_conf_free(g_spdk_app.config);
		exit(EXIT_FAILURE);
	}

@@ -355,6 +359,7 @@ spdk_app_init(struct spdk_app_opts *opts)
		rc = sigaction(SIGINT, &sigact, NULL);
		if (rc < 0) {
			SPDK_ERRLOG("sigaction(SIGINT) failed\n");
			spdk_conf_free(g_spdk_app.config);
			exit(EXIT_FAILURE);
		}
		sigaddset(&signew, SIGINT);
@@ -364,6 +369,7 @@ spdk_app_init(struct spdk_app_opts *opts)
		rc = sigaction(SIGTERM, &sigact, NULL);
		if (rc < 0) {
			SPDK_ERRLOG("sigaction(SIGTERM) failed\n");
			spdk_conf_free(g_spdk_app.config);
			exit(EXIT_FAILURE);
		}
		sigaddset(&signew, SIGTERM);
@@ -375,6 +381,7 @@ spdk_app_init(struct spdk_app_opts *opts)
		rc = sigaction(SIGUSR1, &sigact, NULL);
		if (rc < 0) {
			SPDK_ERRLOG("sigaction(SIGUSR1) failed\n");
			spdk_conf_free(g_spdk_app.config);
			exit(EXIT_FAILURE);
		}
		sigaddset(&signew, SIGUSR1);
@@ -407,6 +414,7 @@ spdk_app_init(struct spdk_app_opts *opts)
	rc = spdk_subsystem_init();
	if (rc < 0) {
		SPDK_ERRLOG("spdk_subsystem_init() failed\n");
		spdk_conf_free(g_spdk_app.config);
		exit(EXIT_FAILURE);
	}
}