summaryrefslogtreecommitdiffstats
path: root/xlators/debug
diff options
context:
space:
mode:
authorCsaba Henk <csaba@gluster.com>2009-11-29 19:26:57 +0000
committerAnand V. Avati <avati@dev.gluster.com>2009-11-30 03:06:42 -0800
commit2a3adcfe5c8d649a17b2d30f3715f26794dff6bb (patch)
treef390b27c1e36784db1b5469556d1ad06b77882e3 /xlators/debug
parentcc3967db49e5983f43530708c1eb4b2708546ad9 (diff)
fix leaks pointed out by cppcheck static analyzer
See http://cppcheck.sf.net [./build/libglusterfs/src/y.tab.c:2104]: (error) Memory leak: cmd [./libglusterfs/src/md5.c:306]: (error) Resource leak: f [./xlators/debug/io-stats/src/io-stats.c:1396]: (error) Possible null pointer dereference: this - otherwise it is redundant to check if this is null at line 1402 [./xlators/cluster/stripe/src/stripe.c:3597]: (error) Memory leak: dup_str [./xlators/debug/trace/src/trace.c:2426]: (error) Possible null pointer dereference: this - otherwise it is redundant to check if this is null at line 2429 These appear in rarely hit error cases or test/demo code so nothing serious, in fact. Signed-off-by: Csaba Henk <csaba@gluster.com> Signed-off-by: Anand V. Avati <avati@dev.gluster.com> BUG: 420 (fix leaks pointed out by cppcheck static analyzer) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=420
Diffstat (limited to 'xlators/debug')
-rw-r--r--xlators/debug/io-stats/src/io-stats.c3
-rw-r--r--xlators/debug/trace/src/trace.c3
2 files changed, 4 insertions, 2 deletions
diff --git a/xlators/debug/io-stats/src/io-stats.c b/xlators/debug/io-stats/src/io-stats.c
index 1492c355eda..eb950a33d20 100644
--- a/xlators/debug/io-stats/src/io-stats.c
+++ b/xlators/debug/io-stats/src/io-stats.c
@@ -1393,7 +1393,7 @@ process_call_list (io_stats_private_t *priv, const char *list, int include)
int32_t
init (xlator_t *this)
{
- dict_t *options = this->options;
+ dict_t *options = NULL;
char *includes = NULL, *excludes = NULL;
io_stats_private_t *priv = NULL;
size_t size = 0;
@@ -1415,6 +1415,7 @@ init (xlator_t *this)
priv = CALLOC (1, sizeof(*priv));
ERR_ABORT (priv);
+ options = this->options;
includes = data_to_str (dict_get (options, "include-ops"));
excludes = data_to_str (dict_get (options, "exclude-ops"));
diff --git a/xlators/debug/trace/src/trace.c b/xlators/debug/trace/src/trace.c
index 6fe27c635f9..b4fcf29e1e4 100644
--- a/xlators/debug/trace/src/trace.c
+++ b/xlators/debug/trace/src/trace.c
@@ -2423,7 +2423,7 @@ process_call_list (const char *list, int include)
int32_t
init (xlator_t *this)
{
- dict_t *options = this->options;
+ dict_t *options = NULL;
char *includes = NULL, *excludes = NULL;
if (!this)
@@ -2440,6 +2440,7 @@ init (xlator_t *this)
}
+ options = this->options;
includes = data_to_str (dict_get (options, "include-ops"));
excludes = data_to_str (dict_get (options, "exclude-ops"));