xamarin / urho

Code to integrate with the Urho3D engine
Other
463 stars 122 forks source link

Memory leak when return string? #267

Open 1vanK opened 6 years ago

1vanK commented 6 years ago
DllExport const char *
FileSystem_GetAppPreferencesDir (Urho3D::FileSystem *_target, const char * org, const char * app)
{
    return stringdup((_target->GetAppPreferencesDir (Urho3D::String(org), Urho3D::String(app))).CString ());
}

copy is created with every call but where its free?

1vanK commented 6 years ago

I use this way

https://github.com/urho3d/Urho3D/pull/2171/commits/b1c8f1bd0f7d6002f49b141ff9ce77e37382e946

https://github.com/1vanK/Urho3D_DotNetBindings/blob/master/Bindings/IO/FileSystem.cs