diff --git a/Projet/CODE/apm/src/apm_gpu.cu b/Projet/CODE/apm/src/apm_gpu.cu
index da72bab675fd9209f5538053540ba56606d91b69..da11c42190d418de10d7e96c8f5c6466fe67fe3c 100644
--- a/Projet/CODE/apm/src/apm_gpu.cu
+++ b/Projet/CODE/apm/src/apm_gpu.cu
@@ -57,7 +57,7 @@ read_input_file_max(int fd, int *size, off_t offset)
 	printf("diff: %i\n", to_read);
 #endif
 	/* Allocate data to copy the target text */
-	buf = (char *) malloc(fsize * sizeof(char));
+	buf = (char *) malloc(to_read * sizeof(char));
 
 	if (buf == NULL)
 	{