LBPredictor: Fix old re-initialization code that would lead to crashes
authorPhil Miller <mille121@illinois.edu>
Mon, 26 Mar 2012 17:01:25 +0000 (12:01 -0500)
committerPhil Miller <mille121@illinois.edu>
Mon, 26 Mar 2012 17:01:25 +0000 (12:01 -0500)
The code to change from one load predictor to another was overwriting the
validity array pointer with 'false', effectively NULL-ing it out. This would
cause a crash on the next use, but was apparently never tested. That code
was supposed to make each entry in the array false, so do that instead.

Detected thanks to g++-4.7 -Werror.

src/ck-ldb/CentralLB.h

index 30f227f139eddcd0e5ef99f25c8255137aa09907..0d70342590dc44c9abb365803aeae93929ca8970 100644 (file)
@@ -163,7 +163,7 @@ public:
       for (i=0;i<n_objs;++i) delete[] parameters[i];
       for (i=0;i<n_objs;++i) {
        parameters[i] = new double[new_predictor->num_params];
-       model_valid = false;
+       model_valid[i] = false;
       }
     }
   };