From 2a3adcfe5c8d649a17b2d30f3715f26794dff6bb Mon Sep 17 00:00:00 2001 From: Csaba Henk Date: Sun, 29 Nov 2009 19:26:57 +0000 Subject: 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 Signed-off-by: Anand V. Avati BUG: 420 (fix leaks pointed out by cppcheck static analyzer) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=420 --- xlators/cluster/stripe/src/stripe.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'xlators/cluster/stripe') diff --git a/xlators/cluster/stripe/src/stripe.c b/xlators/cluster/stripe/src/stripe.c index 4f676435150..10251e78c68 100644 --- a/xlators/cluster/stripe/src/stripe.c +++ b/xlators/cluster/stripe/src/stripe.c @@ -3594,8 +3594,10 @@ set_stripe_block_size (xlator_t *this, stripe_private_t *priv, char *data) while (stripe_str) { dup_str = strdup (stripe_str); stripe_opt = CALLOC (1, sizeof (struct stripe_options)); - if (!stripe_opt) + if (!stripe_opt) { + FREE (dup_str); goto out; + } pattern = strtok_r (dup_str, ":", &tmp_str1); num = strtok_r (NULL, ":", &tmp_str1); -- cgit