]> git.xonotic.org Git - xonotic/gmqcc.git/blobdiff - exec.c
Fixed possible bug in VM. Added coverity rules to makefiles.
[xonotic/gmqcc.git] / exec.c
diff --git a/exec.c b/exec.c
index 05d6d8df1a6dd0701650cc5d866a755c9907d20e..00f32f1c24060ae10708685d8024e02c736eea9f 100644 (file)
--- a/exec.c
+++ b/exec.c
@@ -56,7 +56,7 @@ qc_program* prog_load(const char *filename, bool skipversion)
 {
     qc_program   *prog;
     prog_header   header;
-    FILE         *file   = fs_file_open(filename, "rb");
+    FILE         *file  = fs_file_open(filename, "rb");
 
     if (!file)
         return NULL;
@@ -144,6 +144,8 @@ error:
     vec_free(prog->entitydata);
     vec_free(prog->entitypool);
     mem_d(prog);
+
+    fs_file_close(file);
     return NULL;
 }
 
@@ -302,7 +304,9 @@ static void trace_print_global(qc_program *prog, unsigned int glob, int vtype) {
     int       len;
 
     if (!glob) {
-        len = printf("<null>,");
+        if ((len = printf("<null>,")) == -1)
+            len = 0;
+
         goto done;
     }