Reuse existing repository instance for GetHash and GetMapHashToFriendName

Signed-off-by: Sven Strickroth <email@cs-ware.de>
Fix possible resource leaks (by using CSmartHandle)

Signed-off-by: Sven Strickroth <email@cs-ware.de>
Handle return codes of RunAsync

Prevents us from working with invalid handles.

Signed-off-by: Sven Strickroth <email@cs-ware.de>
Refactored

Reduce indention, use unique_ptr and return as early as possible.

Signed-off-by: Sven Strickroth <email@cs-ware.de>