summaryrefslogtreecommitdiff
path: root/sbc
diff options
context:
space:
mode:
authorGustavo F. Padovan <gustavo@padovan.org>2010-06-05 07:14:28 -0300
committerJohan Hedberg <johan.hedberg@nokia.com>2010-06-08 15:57:22 +0800
commit502bfaf2bccfac0826a3802a5e95bafaf976d981 (patch)
treed29d891bae430a1fa87b1be334c25d830737fac8 /sbc
parente272c8c69b748abb0a58f57e7c13c9a35b5eb0c3 (diff)
downloadbluez-502bfaf2bccfac0826a3802a5e95bafaf976d981.tar.gz
sbc: Fix redundant null check on calling free()
Issues found by smatch static check: http://smatch.sourceforge.net/
Diffstat (limited to 'sbc')
-rw-r--r--sbc/sbc.c3
-rw-r--r--sbc/sbcdec.c9
2 files changed, 4 insertions, 8 deletions
diff --git a/sbc/sbc.c b/sbc/sbc.c
index edd152fa2..86399dd80 100644
--- a/sbc/sbc.c
+++ b/sbc/sbc.c
@@ -1138,8 +1138,7 @@ void sbc_finish(sbc_t *sbc)
if (!sbc)
return;
- if (sbc->priv_alloc_base)
- free(sbc->priv_alloc_base);
+ free(sbc->priv_alloc_base);
memset(sbc, 0, sizeof(sbc_t));
}
diff --git a/sbc/sbcdec.c b/sbc/sbcdec.c
index 77b8aedcf..7008e8844 100644
--- a/sbc/sbcdec.c
+++ b/sbc/sbcdec.c
@@ -259,15 +259,13 @@ int main(int argc, char *argv[])
break;
case 'd':
- if (output)
- free(output);
+ free(output);
output = strdup(optarg);
tofile = 0;
break;
case 'f' :
- if (output)
- free(output);
+ free(output);
output = strdup(optarg);
tofile = 1;
break;
@@ -289,8 +287,7 @@ int main(int argc, char *argv[])
for (i = 0; i < argc; i++)
decode(argv[i], output ? output : "/dev/dsp", tofile);
- if (output)
- free(output);
+ free(output);
return 0;
}