[MM] [PATCH] qcdm: remove unnecessary NULL check on free()
- From: Ben Chan <benchan chromium org>
- To: networkmanager-list gnome org
- Cc: Aleksander Morgado <aleksander lanedo com>
- Subject: [MM] [PATCH] qcdm: remove unnecessary NULL check on free()
- Date: Wed, 24 Apr 2013 17:37:55 -0700
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>
---
 libqcdm/src/result.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/libqcdm/src/result.c b/libqcdm/src/result.c
index d51a050..d508fb7 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));
-- 
1.8.2.1
[
Date Prev][
Date Next]   [
Thread Prev][
Thread Next]   
[
Thread Index]
[
Date Index]
[
Author Index]