Fixed intialization of 3-deep arrays in CPP
authorErich Keane <erich.keane@intel.com>
Wed, 9 Sep 2015 16:40:58 +0000 (09:40 -0700)
committerJon A. Cruz <jonc@osg.samsung.com>
Wed, 9 Sep 2015 20:51:07 +0000 (20:51 +0000)
The C++ 3 deep arrays were seg-faulting, since the initial vector
was not initialized correctly with the size.  This patch ensures
that this happens correctly.

I've validated that the 3 deep array of Ints works correctly after
this patch.

Change-Id: I55166105d2a6a9ee97d88e287b54705a8f175cb6
Signed-off-by: Erich Keane <erich.keane@intel.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/2432
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Jon A. Cruz <jonc@osg.samsung.com>
resource/src/OCRepresentation.cpp

index f65f4b0..5649f90 100644 (file)
@@ -491,7 +491,7 @@ namespace OC
         }
         else if (depth == 3)
         {
-            std::vector<std::vector<std::vector<T>>> val;
+            std::vector<std::vector<std::vector<T>>> val(pl->arr.dimensions[0]);
             for(size_t i = 0; i < pl->arr.dimensions[0]; ++i)
             {
                 val[i].resize(pl->arr.dimensions[1]);