summaryrefslogtreecommitdiffstats
path: root/libglusterfs
diff options
context:
space:
mode:
authorPranith Kumar K <pranithk@gluster.com>2010-08-31 12:52:34 +0000
committerVijay Bellur <vijay@dev.gluster.com>2010-08-31 11:31:23 -0700
commit70652df2f7780aa734119941ac54d88ae6de7ae9 (patch)
tree96928b36d2412c211846e52d73dd2b3fb45b420f /libglusterfs
parente7cbae70c89c8813918d9deb3895cb6886cdaeeb (diff)
mgmt/glusterd: memory leak fixes
Signed-off-by: Pranith Kumar K <pranithk@gluster.com> Signed-off-by: Vijay Bellur <vijay@dev.gluster.com> BUG: 1186 () URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1186
Diffstat (limited to 'libglusterfs')
-rw-r--r--libglusterfs/src/dict.c2
-rw-r--r--libglusterfs/src/mem-types.h150
-rw-r--r--libglusterfs/src/scheduler.c16
-rw-r--r--libglusterfs/src/timer.c1
-rw-r--r--libglusterfs/src/xlator.c9
5 files changed, 96 insertions, 82 deletions
diff --git a/libglusterfs/src/dict.c b/libglusterfs/src/dict.c
index 34a0c6860ec..f2528aeebda 100644
--- a/libglusterfs/src/dict.c
+++ b/libglusterfs/src/dict.c
@@ -269,6 +269,8 @@ _dict_set (dict_t *this,
"@pair->key - NULL returned by CALLOC");
FREE (pair);
+ if (key_free)
+ GF_FREE (key);
return -1;
}
diff --git a/libglusterfs/src/mem-types.h b/libglusterfs/src/mem-types.h
index e8c8427e807..ace869d708a 100644
--- a/libglusterfs/src/mem-types.h
+++ b/libglusterfs/src/mem-types.h
@@ -22,80 +22,80 @@
enum gf_common_mem_types_ {
- gf_common_mt_call_stub_t = 0,
- gf_common_mt_dnscache6,
- gf_common_mt_data_pair_t,
- gf_common_mt_data_t,
- gf_common_mt_dict_t,
- gf_common_mt_event_pool,
- gf_common_mt_reg,
- gf_common_mt_pollfd,
- gf_common_mt_epoll_event,
- gf_common_mt_fdentry_t,
- gf_common_mt_fdtable_t,
- gf_common_mt_fd_t,
- gf_common_mt_fd_ctx,
- gf_common_mt_gf_dirent_t,
- gf_common_mt_glusterfs_ctx_t,
- gf_common_mt_dentry_t,
- gf_common_mt_inode_t,
- gf_common_mt_inode_ctx,
- gf_common_mt_list_head,
- gf_common_mt_inode_table_t,
- gf_common_mt_xlator_t,
- gf_common_mt_xlator_list_t,
- gf_common_mt_log_msg,
- gf_common_mt_client_log,
- gf_common_mt_volume_opt_list_t,
- gf_common_mt_gf_hdr_common_t,
- gf_common_mt_call_frame_t,
- gf_common_mt_call_stack_t,
- gf_common_mt_gf_timer_t,
- gf_common_mt_gf_timer_registry_t,
- gf_common_mt_transport,
- gf_common_mt_transport_msg,
- gf_common_mt_auth_handle_t,
- gf_common_mt_iobuf,
- gf_common_mt_iobuf_arena,
- gf_common_mt_iobref,
- gf_common_mt_iobuf_pool,
- gf_common_mt_iovec,
- gf_common_mt_memdup,
- gf_common_mt_asprintf,
- gf_common_mt_strdup,
- gf_common_mt_socket_private_t,
- gf_common_mt_ioq,
- gf_common_mt_transport_t,
- gf_common_mt_socket_local_t,
- gf_common_mt_char,
- gf_common_mt_rbthash_table_t,
- gf_common_mt_rbthash_bucket,
- gf_common_mt_mem_pool,
- gf_common_mt_long,
- gf_common_mt_rpcsvc_auth_list,
- gf_common_mt_rpcsvc_t,
- gf_common_mt_rpcsvc_conn_t,
- gf_common_mt_rpcsvc_program_t,
- gf_common_mt_rpcsvc_listener_t,
- gf_common_mt_rpcsvc_wrapper_t,
- gf_common_mt_rpcsvc_stage_t,
- gf_common_mt_rpcclnt_t,
- gf_common_mt_rpcclnt_savedframe_t,
- gf_common_mt_rpc_trans_t,
- gf_common_mt_rpc_trans_pollin_t,
- gf_common_mt_rpc_trans_handover_t,
- gf_common_mt_rpc_trans_reqinfo_t,
- gf_common_mt_rpc_trans_rsp_t,
- gf_common_mt_glusterfs_graph_t,
- gf_common_mt_rdma_private_t,
- gf_common_mt_rdma_ioq_t,
- gf_common_mt_rpc_transport_t,
- gf_common_mt_rdma_local_t,
- gf_common_mt_rdma_post_t,
- gf_common_mt_qpent,
- gf_common_mt_rdma_device_t,
- gf_common_mt_rdma_context_t,
- gf_common_mt_sge,
- gf_common_mt_end
+ gf_common_mt_call_stub_t = 0,
+ gf_common_mt_dnscache6 = 1,
+ gf_common_mt_data_pair_t = 2,
+ gf_common_mt_data_t = 3,
+ gf_common_mt_dict_t = 4,
+ gf_common_mt_event_pool = 5,
+ gf_common_mt_reg = 6,
+ gf_common_mt_pollfd = 7,
+ gf_common_mt_epoll_event = 8,
+ gf_common_mt_fdentry_t = 9,
+ gf_common_mt_fdtable_t = 10,
+ gf_common_mt_fd_t = 11,
+ gf_common_mt_fd_ctx = 12,
+ gf_common_mt_gf_dirent_t = 13,
+ gf_common_mt_glusterfs_ctx_t = 14,
+ gf_common_mt_dentry_t = 15,
+ gf_common_mt_inode_t = 16,
+ gf_common_mt_inode_ctx = 17,
+ gf_common_mt_list_head = 18,
+ gf_common_mt_inode_table_t = 19,
+ gf_common_mt_xlator_t = 20,
+ gf_common_mt_xlator_list_t = 21,
+ gf_common_mt_log_msg = 22,
+ gf_common_mt_client_log = 23,
+ gf_common_mt_volume_opt_list_t = 24,
+ gf_common_mt_gf_hdr_common_t = 25,
+ gf_common_mt_call_frame_t = 26,
+ gf_common_mt_call_stack_t = 27,
+ gf_common_mt_gf_timer_t = 28,
+ gf_common_mt_gf_timer_registry_t= 29,
+ gf_common_mt_transport = 30,
+ gf_common_mt_transport_msg = 31,
+ gf_common_mt_auth_handle_t = 32,
+ gf_common_mt_iobuf = 33,
+ gf_common_mt_iobuf_arena = 34,
+ gf_common_mt_iobref = 35,
+ gf_common_mt_iobuf_pool = 36,
+ gf_common_mt_iovec = 37,
+ gf_common_mt_memdup = 38,
+ gf_common_mt_asprintf = 39,
+ gf_common_mt_strdup = 40,
+ gf_common_mt_socket_private_t = 41,
+ gf_common_mt_ioq = 42,
+ gf_common_mt_transport_t = 43,
+ gf_common_mt_socket_local_t = 44,
+ gf_common_mt_char = 45,
+ gf_common_mt_rbthash_table_t = 46,
+ gf_common_mt_rbthash_bucket = 47,
+ gf_common_mt_mem_pool = 48,
+ gf_common_mt_long = 49,
+ gf_common_mt_rpcsvc_auth_list = 50,
+ gf_common_mt_rpcsvc_t = 51,
+ gf_common_mt_rpcsvc_conn_t = 52,
+ gf_common_mt_rpcsvc_program_t = 53,
+ gf_common_mt_rpcsvc_listener_t = 54,
+ gf_common_mt_rpcsvc_wrapper_t = 55,
+ gf_common_mt_rpcsvc_stage_t = 56,
+ gf_common_mt_rpcclnt_t = 57,
+ gf_common_mt_rpcclnt_savedframe_t = 58,
+ gf_common_mt_rpc_trans_t = 59,
+ gf_common_mt_rpc_trans_pollin_t = 60,
+ gf_common_mt_rpc_trans_handover_t = 61,
+ gf_common_mt_rpc_trans_reqinfo_t= 62,
+ gf_common_mt_rpc_trans_rsp_t = 63,
+ gf_common_mt_glusterfs_graph_t = 64,
+ gf_common_mt_rdma_private_t = 65,
+ gf_common_mt_rdma_ioq_t = 66,
+ gf_common_mt_rpc_transport_t = 67,
+ gf_common_mt_rdma_local_t = 68,
+ gf_common_mt_rdma_post_t = 69,
+ gf_common_mt_qpent = 70,
+ gf_common_mt_rdma_device_t = 71,
+ gf_common_mt_rdma_context_t = 72,
+ gf_common_mt_sge = 73,
+ gf_common_mt_end = 74
};
#endif
diff --git a/libglusterfs/src/scheduler.c b/libglusterfs/src/scheduler.c
index 94131676e17..3fcaef73b57 100644
--- a/libglusterfs/src/scheduler.c
+++ b/libglusterfs/src/scheduler.c
@@ -54,16 +54,18 @@ get_scheduler (xlator_t *xl, const char *name)
handle = dlopen (sched_file, RTLD_LAZY);
if (!handle) {
- gf_log ("scheduler", GF_LOG_ERROR,
- "dlopen(%s): %s", sched_file, dlerror ());
- return NULL;
+ gf_log ("scheduler", GF_LOG_ERROR,
+ "dlopen(%s): %s", sched_file, dlerror ());
+ GF_FREE(sched_file);
+ return NULL;
}
tmp_sched = dlsym (handle, "sched");
if (!tmp_sched) {
- gf_log ("scheduler", GF_LOG_ERROR,
- "dlsym(sched) on %s", dlerror ());
- return NULL;
+ gf_log ("scheduler", GF_LOG_ERROR,
+ "dlsym(sched) on %s", dlerror ());
+ GF_FREE(sched_file);
+ return NULL;
}
vol_opt = GF_CALLOC (1, sizeof (volume_opt_list_t),
@@ -78,10 +80,12 @@ get_scheduler (xlator_t *xl, const char *name)
== -1) {
gf_log ("scheduler", GF_LOG_ERROR,
"volume option validation failed");
+ GF_FREE(sched_file);
return NULL;
}
}
GF_FREE(sched_file);
+ GF_FREE (vol_opt);
return tmp_sched;
}
diff --git a/libglusterfs/src/timer.c b/libglusterfs/src/timer.c
index 433eeb7dfb9..0ef1190c324 100644
--- a/libglusterfs/src/timer.c
+++ b/libglusterfs/src/timer.c
@@ -118,6 +118,7 @@ gf_timer_call_cancel (glusterfs_ctx_t *ctx,
reg = gf_timer_registry_init (ctx);
if (!reg) {
gf_log ("timer", GF_LOG_ERROR, "!reg");
+ GF_FREE (event);
return 0;
}
diff --git a/libglusterfs/src/xlator.c b/libglusterfs/src/xlator.c
index fd7db3e032c..2074c143c8c 100644
--- a/libglusterfs/src/xlator.c
+++ b/libglusterfs/src/xlator.c
@@ -700,6 +700,7 @@ xlator_set_type (xlator_t *xl,
handle = dlopen (name, RTLD_NOW|RTLD_GLOBAL);
if (!handle) {
gf_log ("xlator", GF_LOG_DEBUG, "%s", dlerror ());
+ GF_FREE (name);
return -1;
}
xl->dlhandle = handle;
@@ -707,24 +708,28 @@ xlator_set_type (xlator_t *xl,
if (!(xl->fops = dlsym (handle, "fops"))) {
gf_log ("xlator", GF_LOG_DEBUG, "dlsym(fops) on %s",
dlerror ());
+ GF_FREE (name);
return -1;
}
if (!(xl->cbks = dlsym (handle, "cbks"))) {
gf_log ("xlator", GF_LOG_DEBUG, "dlsym(cbks) on %s",
dlerror ());
+ GF_FREE (name);
return -1;
}
if (!(xl->init = dlsym (handle, "init"))) {
gf_log ("xlator", GF_LOG_DEBUG, "dlsym(init) on %s",
dlerror ());
+ GF_FREE (name);
return -1;
}
if (!(xl->fini = dlsym (handle, "fini"))) {
gf_log ("xlator", GF_LOG_DEBUG, "dlsym(fini) on %s",
dlerror ());
+ GF_FREE (name);
return -1;
}
@@ -749,8 +754,10 @@ xlator_set_type (xlator_t *xl,
vol_opt = GF_CALLOC (1, sizeof (volume_opt_list_t),
gf_common_mt_volume_opt_list_t);
- if (!vol_opt)
+ if (!vol_opt) {
+ GF_FREE (name);
return -1;
+ }
if (!(vol_opt->given_opt = dlsym (handle, "options"))) {
dlerror ();