diff --git a/supervisor.c b/supervisor.c index 385acc7..9fb3be7 100644 --- a/supervisor.c +++ b/supervisor.c @@ -137,11 +137,11 @@ void getSolution(sem_t *sUsedSpace, sem_t *sFreeSpace) if (newSolutionLength < bestSolutionLength) { // Set all entries of bestSolution to -1 - for (int i = 0; i < bestSolutionLength; i++) { + for (int i = 0; i < MAX_ITEMS; i++) { bestSolution[i] = -1; } // Copy all entries from solution to bestSolution - for (int i = 0; i < newSolutionLength; i++) { + for (int i = 0; i < MAX_ITEMS; i++) { bestSolution[i] = solution[i]; }