diff options
author | Gustavo F. Padovan <gustavo@padovan.org> | 2010-06-05 07:14:28 -0300 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2012-07-29 19:48:29 -0700 |
commit | 6e673555988c51f5fad8c435d2f5465ac887e627 (patch) | |
tree | 1e1076c4e3d19edb1232f793260f02b61de6b7e7 | |
parent | 9a36588ca8908f925f322bbf62725b3b844a1ff7 (diff) | |
download | sbc-6e673555988c51f5fad8c435d2f5465ac887e627.tar.gz |
sbc: Fix redundant null check on calling free()
Issues found by smatch static check: http://smatch.sourceforge.net/
-rw-r--r-- | sbc/sbc.c | 3 | ||||
-rw-r--r-- | sbc/sbcdec.c | 9 |
2 files changed, 4 insertions, 8 deletions
@@ -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 77b8aed..7008e88 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; } |