]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
common/cmdparse: no need to use (and leak to) the heap
authorSage Weil <sage@inktank.com>
Tue, 11 Jun 2013 00:11:44 +0000 (17:11 -0700)
committerSage Weil <sage@inktank.com>
Tue, 11 Jun 2013 04:56:03 +0000 (21:56 -0700)
Signed-off-by: Sage Weil <sage@inktank.com>
Reviewed-by: Dan Mick <dan.mick@inktank.com>
src/common/cmdparse.cc

index 467c2140cb04463e504c05d3b33cef390eb4e75e..d4984d1d3325bd1594c839dd296d85e3413b1527 100644 (file)
@@ -138,14 +138,14 @@ cmdmap_from_json(vector<string> cmd, map<string, cmd_vartype> *mapp, stringstrea
          // array is a vector of values.  Unpack it to a vector
          // of strings, the only type we handle.
          vector<json_spirit::mValue> spvals = it->second.get_array();
-         vector<string> *outvp = new vector<string>;
+         vector<string> outv;
          for (vector<json_spirit::mValue>::iterator sv = spvals.begin();
               sv != spvals.end(); sv++) {
            if (sv->type() != json_spirit::str_type)
              throw(runtime_error("Can't handle arrays of non-strings"));
-           outvp->push_back(sv->get_str());
+           outv.push_back(sv->get_str());
          }
-         (*mapp)[it->first] = *outvp;
+         (*mapp)[it->first] = outv;
        }
        break;
       case json_spirit::str_type: