diff --git a/generate/templates/templates/struct_content.cc b/generate/templates/templates/struct_content.cc index 3bb619d92..bc620d582 100644 --- a/generate/templates/templates/struct_content.cc +++ b/generate/templates/templates/struct_content.cc @@ -32,14 +32,12 @@ using namespace std; {{ cppClassName }}::{{ cppClassName }}() : NodeGitWrapper<{{ cppClassName }}Traits>(NULL, true, v8::Local()) { {% if ignoreInit == true %} - // TODO: this looks like a memory leak to me - we are allocating wrappedValue - // then copying it below, but never freeing it - {{ cType }}* wrappedValue = new {{ cType }}; + this->raw = new {{ cType }}; {% else %} {{ cType }} wrappedValue = {{ cType|upper }}_INIT; - {% endif %} this->raw = ({{ cType }}*) malloc(sizeof({{ cType }})); memcpy(this->raw, &wrappedValue, sizeof({{ cType }})); + {% endif %} this->ConstructFields(); }