summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Chan <benchan@chromium.org>2013-04-24 17:37:55 -0700
committerAleksander Morgado <aleksander@lanedo.com>2013-04-25 08:46:00 +0200
commit1f99eaf80e6c3124c871c416638d50c57199535e (patch)
tree214604617851069fff60605eb57ec1396c4f3974
parentd1708f243dfdb2fe6a478be6e616f70fca50b254 (diff)
downloadModemManager-1f99eaf80e6c3124c871c416638d50c57199535e.tar.gz
qcdm: remove unnecessary NULL check on free()
This patch removes a few unnecessary NULL checks on free(), which also fixes the following clang warnings: result.c:59:27: error: if statement has empty body [-Werror,-Wempty-body] if (v->u.u8_array); ^ result.c:59:27: note: put the semicolon on a separate line to silence this warning result.c:62:28: error: if statement has empty body [-Werror,-Wempty-body] if (v->u.u16_array); ^ result.c:62:28: note: put the semicolon on a separate line to silence this warning Bug reported on https://code.google.com/p/chromium/issues/detail?id=219280 Patched by Yunlian Jiang <yunlian@chromium.org>
-rw-r--r--libqcdm/src/result.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/libqcdm/src/result.c b/libqcdm/src/result.c
index d51a0502a..d508fb760 100644
--- a/libqcdm/src/result.c
+++ b/libqcdm/src/result.c
@@ -53,14 +53,11 @@ static void
val_free (Val *v)
{
if (v->type == VAL_TYPE_STRING) {
- if (v->u.s)
- free (v->u.s);
+ free (v->u.s);
} else if (v->type == VAL_TYPE_U8_ARRAY) {
- if (v->u.u8_array);
- free (v->u.u8_array);
+ free (v->u.u8_array);
} else if (v->type == VAL_TYPE_U16_ARRAY) {
- if (v->u.u16_array);
- free (v->u.u16_array);
+ free (v->u.u16_array);
}
free (v->key);
memset (v, 0, sizeof (*v));