avoid invalid calls to memcpy(): when ndot == 0, pointers may be NULL

This commit is contained in:
Axel Kohlmeyer
2017-07-26 12:08:42 -04:00
parent aa5ea95a0f
commit 51a06334ad

View File

@ -461,7 +461,7 @@ void RCB::compute(int dimension, int n, double **x, double *wt,
largest = smaller;
dim_select = dim;
valuehalf_select = valuehalf;
memcpy(dotmark_select,dotmark,ndot*sizeof(int));
if (ndot > 0) memcpy(dotmark_select,dotmark,ndot*sizeof(int));
}
}
@ -469,7 +469,7 @@ void RCB::compute(int dimension, int n, double **x, double *wt,
dim = dim_select;
valuehalf = valuehalf_select;
memcpy(dotmark,dotmark_select,ndot*sizeof(int));
if (ndot > 0) memcpy(dotmark,dotmark_select,ndot*sizeof(int));
// found median
// store cut info only if I am procmid