There is a leak there (coverity 126870): FreeImageData(pixelDataIn); should be called on this exit path. While it could be called directly, a scope guard would be preferable, as it would avoid the duplicate function call and cover all possible [even future] exit branches.
Alternatively, Urho’s smart pointers could support custom deleters, but that would be more work.
Alas, our SharedPtr is not a generic container. It can only contain Urho’s own refcounted object. Eugene has a PR which proposes a more generic container ala non-refcounted. But I don’t think it has ctor that takes a high-level function or lambda as deleter (yet). So at the moment, just do with what we got first, fixing it the old fashion way.