Commit 51a06334 authored by Axel Kohlmeyer's avatar Axel Kohlmeyer
Browse files

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

parent aa5ea95a
Loading
Loading
Loading
Loading
+9 −9
Original line number Diff line number Diff line
@@ -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