From 8fc2eee2b4829b3b72d1ae9f877b968ddde2a7e3 Mon Sep 17 00:00:00 2001 From: Thad House Date: Mon, 9 Nov 2015 22:05:38 -0800 Subject: [PATCH] Makes Value::MakeStringArray properly set size The Value::MakeStringArray methods were not setting the size of the arr_string. This was causing the NT_Value struct called from the C entry listener callback to not have the array size, which would then cause the GetValueStringArray method to fail the malloc. --- src/Value.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Value.cpp b/src/Value.cpp index ae7c966b55..8095fa9dff 100644 --- a/src/Value.cpp +++ b/src/Value.cpp @@ -58,6 +58,7 @@ std::shared_ptr Value::MakeStringArray( val->m_string_array = value; // point NT_Value to the contents in the vector. val->m_val.data.arr_string.arr = new NT_String[value.size()]; + val->m_val.data.arr_string.size = val->m_string_array.size(); for (std::size_t i=0; im_val.data.arr_string.arr[i].str = const_cast(value[i].c_str()); val->m_val.data.arr_string.arr[i].len = value[i].size(); @@ -72,6 +73,7 @@ std::shared_ptr Value::MakeStringArray( value.clear(); // point NT_Value to the contents in the vector. val->m_val.data.arr_string.arr = new NT_String[val->m_string_array.size()]; + val->m_val.data.arr_string.size = val->m_string_array.size(); for (std::size_t i=0; im_string_array.size(); ++i) { val->m_val.data.arr_string.arr[i].str = const_cast(val->m_string_array[i].c_str());