From 6231c601c353c45253ec97ed6cec56bbd759d30a Mon Sep 17 00:00:00 2001
From: Giovanni La Mura <giovanni.lamura@inaf.it>
Date: Fri, 19 Apr 2024 16:14:33 +0200
Subject: [PATCH] Fix valgrind detected invalid read

---
 src/sphere/sphere.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/sphere/sphere.cpp b/src/sphere/sphere.cpp
index c3dbdc02..c851f401 100644
--- a/src/sphere/sphere.cpp
+++ b/src/sphere/sphere.cpp
@@ -225,7 +225,7 @@ void sphere(string config_file, string data_file, string output_path) {
 	  c1->rc[i116][j115] = sconf->get_rcf(i116, j115) * c1->ros[i116];
 	}
       }
-      gcs += c1->gcsv[iogi];
+      gcs += c1->gcsv[iogi - 1];
     }
     double ****zpv = new double***[l_max]; //[l_max][3][2][2]; // Matrix: dim[LM x 3 x 2 x 2]
     for (int zi = 0; zi < l_max; zi++) {
-- 
GitLab