Signed-off-by: Gerd Hoffmann <kra...@redhat.com>
---
 util/module.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/util/module.c b/util/module.c
index 564b8e3da760..4f98cc74ae37 100644
--- a/util/module.c
+++ b/util/module.c
@@ -158,7 +158,7 @@ static void module_load_modinfo(void)
 {
     char *file, *json;
     FILE *fp;
-    int i, size;
+    int i, size, ret;
     Visitor *v;
     Error *errp = NULL;
 
@@ -185,8 +185,8 @@ static void module_load_modinfo(void)
     size = ftell(fp);
     fseek(fp, 0, SEEK_SET);
     json = g_malloc0(size + 1);
-    fread(json, size, 1, fp);
-    json[size] = 0;
+    ret = fread(json, 1, size, fp);
+    json[ret] = 0;
     fclose(fp);
 
     v = qobject_input_visitor_new_str(json, NULL, &errp);
-- 
2.31.1


Reply via email to