[Libosinfo] [osinfo-db-tools PATCH 2/3] export: Remove unused variable

Fabiano Fidêncio fidencio at redhat.com
Mon May 20 12:39:12 UTC 2019


err is declared, set to NULL, but never used in
osinfo_db_export_create().

Error: DEADCODE (CWE-561):
osinfo-db-tools-1.5.0/tools/osinfo-db-export.c:410: assignment:
Assigning: "err" = "NULL".
osinfo-db-tools-1.5.0/tools/osinfo-db-export.c:448: null: At condition
"err", the value of "err" must be "NULL".
osinfo-db-tools-1.5.0/tools/osinfo-db-export.c:448: dead_error_condition:
The condition "err" cannot be true.
osinfo-db-tools-1.5.0/tools/osinfo-db-export.c:449: dead_error_line:
Execution cannot reach this statement: "g_error_free(err);".
osinfo-db-tools-1.5.0/tools/osinfo-db-export.c:449: effectively_constant:
Local variable "err" is assigned only once, to a constant value, making
it effectively constant throughout its scope. If this is not the intent,
examine the logic to see if there is a missing assigment that would make
"err" not remain constant.
 #  447|       archive_write_free(arc);
 #  448|       if (err)
 #  449|->         g_error_free(err);
 #  450|       return ret;
 #  451|   }

Signed-off-by: Fabiano Fidêncio <fidencio at redhat.com>
---
 tools/osinfo-db-export.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/tools/osinfo-db-export.c b/tools/osinfo-db-export.c
index 3137e1d..eef6688 100644
--- a/tools/osinfo-db-export.c
+++ b/tools/osinfo-db-export.c
@@ -407,7 +407,6 @@ static int osinfo_db_export_create(const gchar *prefix,
     struct archive *arc;
     int ret = -1;
     int r;
-    GError *err = NULL;
 
     arc = archive_write_new();
 
@@ -445,8 +444,6 @@ static int osinfo_db_export_create(const gchar *prefix,
     ret = 0;
  cleanup:
     archive_write_free(arc);
-    if (err)
-        g_error_free(err);
     return ret;
 }
 
-- 
2.21.0




More information about the Libosinfo mailing list