[Libosinfo] [libosinfo PATCH] loader: refuse to load non-compliant named files

Fabiano Fidêncio fidencio at redhat.com
Thu Jan 3 14:56:27 UTC 2019


There was a period of grace needed for backwards compatibility. After 3+
years, we can safely remove the code instroduced as part of 09ae3cf09
(which was released on 0.3.0).

Signed-off-by: Fabiano Fidêncio <fidencio at redhat.com>
---
 osinfo/osinfo_loader.c | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

diff --git a/osinfo/osinfo_loader.c b/osinfo/osinfo_loader.c
index 77ca5ea..372871e 100644
--- a/osinfo/osinfo_loader.c
+++ b/osinfo/osinfo_loader.c
@@ -523,6 +523,7 @@ static gboolean osinfo_loader_check_id(const gchar *relpath,
     gchar *reldir;
     gboolean extension;
     gsize i;
+    gboolean ret = FALSE;
 
     if (!relpath)
         return TRUE;
@@ -555,17 +556,15 @@ static gboolean osinfo_loader_check_id(const gchar *relpath,
     if (!g_str_equal(extension ? reldir : relpath, name)) {
         g_warning("Entity %s should be in file %s not %s",
                   id, name, extension ? reldir : relpath);
-        g_free(reldir);
-        g_free(name);
-        return TRUE; /* In future switch to FALSE to refuse
-                      * to load non-compliant named files.
-                      * Need a period of grace for backcompat
-                      * first though... Switch ETA Jan 2017
-                      */
+        goto cleanup;
     }
+
+    ret = TRUE;
+
+ cleanup:
     g_free(reldir);
     g_free(name);
-    return TRUE;
+    return ret;
 }
 
 
-- 
2.19.2




More information about the Libosinfo mailing list