function TFirstService.GetServerTime: DateTime;
var
instance: IInterface;
service: TSecondService;
objactivation:IROObjectActivation;
begin
service := TSecondService.Create(nil);
instance := service;
try
if Supports(instance, IROObjectActivation, objactivation) then begin
objactivation.OnActivate(ClientID, nil);
objactivation := nil;
end;
Result := service.GetServerTime();
// Raising an exception here causes a memoryleak. service is not freed
raise EROHttpApiException.Create(501, 'No acccess'); // MEMORY LEAK ?????
if Supports(instance, IROObjectActivation, objactivation) then begin
objactivation.OnDeactivate(ClientId);
objactivation := nil;
end;
finally
instance := nil;
end;
end;