--- a/src/modules/bugs/functions/Rank.cc
+++ b/src/modules/bugs/functions/Rank.cc
@@ -7,7 +7,7 @@
 using std::vector;
 using std::stable_sort;
 
-static bool lt_doubleptr (double const *arg1, double const *arg2) {
+static inline bool lt_doubleptr (double const *arg1, double const *arg2) {
   return *arg1 < *arg2;
 }
 
@@ -25,17 +25,16 @@
 	int N = lengths[0];
 
 	//Create a vector of pointers to the elements of arg and sort it
-	double const **argptrs = new double const *[N];
+	vector<double const*> argptrs(N);
 	for (int i = 0; i < N; ++i) {
 	    argptrs[i] = args[0] + i;
 	}
-	stable_sort(argptrs, argptrs + N, lt_doubleptr);
+	stable_sort(argptrs.begin(), argptrs.end(), lt_doubleptr);
 
 	//Ranks can be inferred from the sorted vector of pointers
 	for (int i = 0; i < N; ++i) {
 	    value[argptrs[i] - args[0]] = i + 1;
 	}
-	delete [] argptrs;
     }
 
     unsigned int Rank::length (vector<unsigned int> const &lengths) const