Fix memory leak
This commit is contained in:
parent
10e388df58
commit
3c82906fc3
@ -716,10 +716,12 @@ double calculateMedian(double *pdIn, int iLen) {
|
|||||||
qsort(pdInSorted, iLen, sizeof(double), compareDoubles);
|
qsort(pdInSorted, iLen, sizeof(double), compareDoubles);
|
||||||
|
|
||||||
if (iLen % 2 == 0) {
|
if (iLen % 2 == 0) {
|
||||||
return (pdIn[iLen/2 - 1] + pdIn[iLen/2]) / 2;
|
return (pdInSorted[iLen/2 - 1] + pdInSorted[iLen/2]) / 2;
|
||||||
} else {
|
} else {
|
||||||
return pdIn[iLen/2];
|
return pdInSorted[iLen/2];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
free(pdInSorted);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user