diff options
author | Bhumika Goyal <bgoyal@redhat.com> | 2018-10-18 17:30:09 +0530 |
---|---|---|
committer | Amar Tumballi <amarts@redhat.com> | 2018-10-22 04:35:05 +0000 |
commit | 92c22abb440ba8f8025441b16f3811b05927a16d (patch) | |
tree | dbc6e8413be289b35657c0296976ad0493ff57cc /xlators | |
parent | ac9976f0c52306f4f2d9b11dcf6a830d1ec2e445 (diff) |
xlators: some high severity coverity fixes
Fixes: 124759 1288787
Change-Id: Ib8999242fc3ea5f4ea80246659899d2d4f06c506
updates: bz#789278
Signed-off-by: Bhumika Goyal <bgoyal@redhat.com>
Diffstat (limited to 'xlators')
-rw-r--r-- | xlators/features/changelog/lib/src/gf-changelog.c | 43 | ||||
-rw-r--r-- | xlators/performance/io-threads/src/io-threads.c | 2 |
2 files changed, 35 insertions, 10 deletions
diff --git a/xlators/features/changelog/lib/src/gf-changelog.c b/xlators/features/changelog/lib/src/gf-changelog.c index c7791c62950..8cfab4fe391 100644 --- a/xlators/features/changelog/lib/src/gf-changelog.c +++ b/xlators/features/changelog/lib/src/gf-changelog.c @@ -100,48 +100,48 @@ gf_changelog_ctx_defaults_init(glusterfs_ctx_t *ctx) ctx->iobuf_pool = iobuf_pool_new(); if (!ctx->iobuf_pool) - return -1; + goto free_pool; ctx->event_pool = event_pool_new(GF_CHANGELOG_EVENT_POOL_SIZE, GF_CHANGELOG_EVENT_THREAD_COUNT); if (!ctx->event_pool) - return -1; + goto free_pool; pool = GF_CALLOC(1, sizeof(call_pool_t), gf_changelog_mt_libgfchangelog_call_pool_t); if (!pool) - return -1; + goto free_pool; /* frame_mem_pool size 112 * 64 */ pool->frame_mem_pool = mem_pool_new(call_frame_t, 32); if (!pool->frame_mem_pool) - return -1; + goto free_pool; /* stack_mem_pool size 256 * 128 */ pool->stack_mem_pool = mem_pool_new(call_stack_t, 16); if (!pool->stack_mem_pool) - return -1; + goto free_pool; ctx->stub_mem_pool = mem_pool_new(call_stub_t, 16); if (!ctx->stub_mem_pool) - return -1; + goto free_pool; ctx->dict_pool = mem_pool_new(dict_t, 32); if (!ctx->dict_pool) - return -1; + goto free_pool; ctx->dict_pair_pool = mem_pool_new(data_pair_t, 512); if (!ctx->dict_pair_pool) - return -1; + goto free_pool; ctx->dict_data_pool = mem_pool_new(data_t, 512); if (!ctx->dict_data_pool) - return -1; + goto free_pool; ctx->logbuf_pool = mem_pool_new(log_buf_t, 256); if (!ctx->logbuf_pool) - return -1; + goto free_pool; INIT_LIST_HEAD(&pool->all_frames); LOCK_INIT(&pool->lock); @@ -158,6 +158,29 @@ gf_changelog_ctx_defaults_init(glusterfs_ctx_t *ctx) setrlimit(RLIMIT_CORE, &lim); return 0; + +free_pool: + GF_FREE(pool->frame_mem_pool); + + GF_FREE(pool->stack_mem_pool); + + GF_FREE(ctx->stub_mem_pool); + + GF_FREE(ctx->dict_pool); + + GF_FREE(ctx->dict_pair_pool); + + GF_FREE(ctx->dict_data_pool); + + GF_FREE(ctx->logbuf_pool); + + GF_FREE(pool); + + GF_FREE(ctx->iobuf_pool); + + GF_FREE(ctx->event_pool); + + return -1; } /* TODO: cleanup ctx defaults */ diff --git a/xlators/performance/io-threads/src/io-threads.c b/xlators/performance/io-threads/src/io-threads.c index c98d1f6ada4..7f1a34676d9 100644 --- a/xlators/performance/io-threads/src/io-threads.c +++ b/xlators/performance/io-threads/src/io-threads.c @@ -1209,6 +1209,8 @@ init(xlator_t *this) if (ret != 0) goto out; + ret = -1; + GF_OPTION_INIT("thread-count", conf->max_count, int32, out); GF_OPTION_INIT("high-prio-threads", conf->ac_iot_limit[GF_FOP_PRI_HI], |