The osinfo_db_import_create_reg() function implements error handling
via jumping to cleanup and returning, however, this way the return
value is not initialised. This breaks build with clang and probably
could lead to an undefined behavior for users of this function.

Fix by initialising ret with -1 by default.
---
 tools/osinfo-db-import.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/osinfo-db-import.c b/tools/osinfo-db-import.c
index 31eaa30..f90bef9 100644
--- a/tools/osinfo-db-import.c
+++ b/tools/osinfo-db-import.c
@@ -39,7 +39,7 @@ static int osinfo_db_import_create_reg(GFile *file,
 {
     GFileOutputStream *os = NULL;
     GError *err = NULL;
-    int ret;
+    int ret = -1;
     int r;
     const void *buf;
     size_t size;
-- 
2.11.0

_______________________________________________
Libosinfo mailing list
Libosinfo@redhat.com
https://www.redhat.com/mailman/listinfo/libosinfo

Reply via email to