diff options
author | Mohit Agrawal <moagrawal@redhat.com> | 2018-11-30 16:07:39 +0530 |
---|---|---|
committer | Amar Tumballi <amarts@redhat.com> | 2019-01-14 04:01:54 +0000 |
commit | 211521f039bb5c883ef444577b5962bad9e18be1 (patch) | |
tree | 82c748d0a3217ebb7b3bb7ce997b11f6ec0b65d1 /libglusterfs | |
parent | 8216ed2171789c8b6c6dc1e44cc171c89b1c063d (diff) |
core: Resolve dict_leak at the time of destroying graph
Problem: In gluster code some of the places it call's get_new_dict
to create a dictionary without taking reference so at the time
of dict_unref it has become a leak
Solution: To resolve the same call dict_new instead of get_new_dict
updates bz#1650403
Change-Id: I3ccbbf5af07079a4fa09aad2cd0458c8625b2f06
Signed-off-by: Mohit Agrawal <moagrawal@redhat.com>
Diffstat (limited to 'libglusterfs')
-rw-r--r-- | libglusterfs/src/dict.c | 6 | ||||
-rw-r--r-- | libglusterfs/src/glusterfs/dict.h | 2 | ||||
-rw-r--r-- | libglusterfs/src/graph.c | 2 | ||||
-rw-r--r-- | libglusterfs/src/graph.y | 2 | ||||
-rw-r--r-- | libglusterfs/src/libglusterfs.sym | 1 | ||||
-rw-r--r-- | libglusterfs/src/xlator.c | 1 |
6 files changed, 2 insertions, 12 deletions
diff --git a/libglusterfs/src/dict.c b/libglusterfs/src/dict.c index 6d3ed4ba9b3..83647b0174a 100644 --- a/libglusterfs/src/dict.c +++ b/libglusterfs/src/dict.c @@ -110,12 +110,6 @@ get_new_dict_full(int size_hint) } dict_t * -get_new_dict(void) -{ - return get_new_dict_full(1); -} - -dict_t * dict_new(void) { dict_t *dict = get_new_dict_full(1); diff --git a/libglusterfs/src/glusterfs/dict.h b/libglusterfs/src/glusterfs/dict.h index 161362bb5cb..52b833fd559 100644 --- a/libglusterfs/src/glusterfs/dict.h +++ b/libglusterfs/src/glusterfs/dict.h @@ -270,8 +270,6 @@ int dict_remove_foreach_fn(dict_t *d, char *k, data_t *v, void *tmp); dict_t * dict_copy(dict_t *this, dict_t *new); -dict_t * -get_new_dict(void); int dict_keys_join(void *value, int size, dict_t *dict, int (*filter_fn)(char *key)); diff --git a/libglusterfs/src/graph.c b/libglusterfs/src/graph.c index 6b50cdbfddf..2dad92a5c53 100644 --- a/libglusterfs/src/graph.c +++ b/libglusterfs/src/graph.c @@ -181,7 +181,7 @@ glusterfs_graph_insert(glusterfs_graph_t *graph, glusterfs_ctx_t *ctx, ixl->ctx = ctx; ixl->graph = graph; - ixl->options = get_new_dict(); + ixl->options = dict_new(); if (!ixl->options) goto err; diff --git a/libglusterfs/src/graph.y b/libglusterfs/src/graph.y index 80ae526d79b..5b929856c5f 100644 --- a/libglusterfs/src/graph.y +++ b/libglusterfs/src/graph.y @@ -164,7 +164,7 @@ new_volume (char *name) goto out; } - curr->options = get_new_dict (); + curr->options = dict_new (); if (!curr->options) { GF_FREE (curr->name); diff --git a/libglusterfs/src/libglusterfs.sym b/libglusterfs/src/libglusterfs.sym index 464493d6cfc..e03cc987c81 100644 --- a/libglusterfs/src/libglusterfs.sym +++ b/libglusterfs/src/libglusterfs.sym @@ -547,7 +547,6 @@ get_checksum_for_path get_file_mtime get_host_name get_mem_size -get_new_dict get_path_name get_struct_variable get_vol_type diff --git a/libglusterfs/src/xlator.c b/libglusterfs/src/xlator.c index 3dc0c648177..bd568660863 100644 --- a/libglusterfs/src/xlator.c +++ b/libglusterfs/src/xlator.c @@ -895,7 +895,6 @@ xlator_mem_free(xlator_t *xl) return 0; if (xl->options) { - dict_ref(xl->options); dict_unref(xl->options); xl->options = NULL; } |