diff --git a/src/expand.cc b/src/expand.cc index 5a56d7c..263d9c1 100644 --- a/src/expand.cc +++ b/src/expand.cc @@ -120,9 +120,10 @@ void ExpandAddress(const Nan::FunctionCallbackInfo& info) { for (i = 0; i < num_expansions; i++) { v8::Local e = Nan::New(expansions[i]).ToLocalChecked(); ret->Set(context, i, e); - free(expansions[i]); } - free(expansions); + + // Free expansions + libpostal_expansion_array_destroy(expansions, num_expansions); info.GetReturnValue().Set(ret); }