[osinfo-db-tools] Fix build with clang

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libosinfo



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Fedora Users]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]

  Powered by Linux