Fix memory leak

This commit is contained in:
Frederik Beimgraben 2025-01-13 02:49:19 +01:00
parent 10e388df58
commit 3c82906fc3

View File

@ -716,10 +716,12 @@ double calculateMedian(double *pdIn, int iLen) {
qsort(pdInSorted, iLen, sizeof(double), compareDoubles);
if (iLen % 2 == 0) {
return (pdIn[iLen/2 - 1] + pdIn[iLen/2]) / 2;
return (pdInSorted[iLen/2 - 1] + pdInSorted[iLen/2]) / 2;
} else {
return pdIn[iLen/2];
return pdInSorted[iLen/2];
}
free(pdInSorted);
}
/*